MySQL数据库:字符集及密码破解。

一,修改Mysql字符集为UTF-8的方法:
[client]:default-character-set=utf8
[mysqld]:character-set-server=utf8
[mysql]:default-character-set=utf8
[root@Centos ~]# systemctl restart mysqld 重新启动服务
二,MySQL忘记密码如何破解:

[root@Centos ~]# systemctl stop mysqld			停止服务
[root@Centos ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql --skip-grant-tables &	跳过密码登录界面
[root@Centos ~]# mysql							进入MySQL数据库
mysql> use mysql;								切换数据库
mysql> update user set password=password('123456') where user='root';	将root用户的密码修改为123456
mysql> flush privileges;						刷新策略
mysql> exit										退出数据库
[root@Centos ~]# systemctl restart mysqld		启动数据库
[root@Centos ~]# mysql -uroot -p123456			用新密码登录数据库
发布了52 篇原创文章 · 获赞 4 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/HCY_2315/article/details/103068155