grep 'temporary password' /var/log/mysqld.log从新安装 Mysql 时,未将旧的内容清理干净
# rm -rf /var/lib/mysql
# service mysqld restart
# grep 'temporary password' /var/log/mysqld.log1. 关闭权限验证。在 my.cnf 文件的[mysqld] 配置中增加 skip-grant-tables。
# vi /etc/my.cnf/* /etc/my.cnf */
...
[mysqld]
skip-grant-tables
...2. 重启 Mysql 服务
# service restart mysqld3. 登录 ROOT 用户
# mysql -u root4. 修改密码及权限
mysql> update mysql.user set authentication_string=password('密码') where user='root';
mysql> grant all privileges on *.* to 'root'@'%' identified by '密码';
mysql> flush privileges;
mysql> exit5. 打开权限验证
删除第一步在 my.cnf 文件中添加的内容
6. 重启 Mysql 服务
# service restart mysqld原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。