-
新安装好的数据库查看初始密码
grep 'temporary password' /var/log/mysqld.log
-
修改密码
-- mysql8.0版本 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY "123456"; -- mysql8.0以下版本 ALTER USER root@localhost IDENTIFIED BY 'admin456rrr';
-
开放远程访问权限
-- mysql8.0版本
CREATE USER 'testuser'@'%' IDENTIFIED BY 'testpwd'; -- 创建用户
GRANT ALL ON *.* TO 'testuser'@'%' WITH GRANT OPTION; -- 授权
flush privileges; -- 刷新权限
-- mysql8.0以下版本
grant all privileges on *.* to root@'%' identified by "password";
flush privileges;