初始化配置,配置密码,全选 n,至Reload privilege tables now?时,选 y 即可
1
sudo mysql_secure_installation
允许 root 远程访问
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## 登陆 mysql sudo mysql -uroot -p ## 配置权限(5.0 版本) GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; ## 配置权限(8.0 版本) CREATE USER 'root'@'%' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON *.* to 'root'@'%' WITH GRANT OPTION; ## 刷新权限 FLUSH PRIVILEGES; ## 查看权限 SELECT User, Host, HEX(authentication_string) FROM mysql.user; ## 修改密码 # set password for root@localhost = password('123456');