## 查看是否成功
mysql -u root -p
## 设置为系统服务开机启动
systemctl enable mysql.service
## 常用命令
systemctl status mysql.service ## 查看状态
systemctl start mysql.service ## 开启服务
systemctl stop mysql.service ## 关闭服务
systemctl restart mysql.service ## 重启服务## 修改远程可以访问cd /etc/mysql/mysql.conf.d/
vim mysqld.cnf
## 修改: bind-address = 127.0.0.1 //修改为0.0.0.0即可# 修改 root 用户不能远程方位# is not allowed to connect tothis mmysql server 解决
mysql -u root -p
use mysql;select host from user where user='root';
update user set host ='%' where user ='root';
flush privileges;## 修改密码
mysql -u root -p
use mysql;## 密码修改为 123
update user set authentication_string = PASSWORD("123") where user='root';
update user set plugin="mysql_native_password";
flush privileges;
quit;## 测试
mysql mysql -u root -p
123