网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 生活百科 知识问答 更多知识

MYSQL置空密码

时间:2026-02-18 22:34:33

1、pstree -p 看看mysql的进程树然后kill -9 pid

设置忽略密码启动mysql服务器mysqld_safe --skip-grant-tables &

输出:[1] 5988Starting mysqld daemon with databases from /var/lib/mysqlmysqld_safe[6025]: started

2、使用mysql客户端连接mysql服务器mysql -u root

输出:Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql>

3、设置一个新的mysql root用户密码mysql> use mysql; mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; mysql> flush privileges; mysql> quit

停止mysql服务器/etc/init.d/mysql stop

启动mysql服务器并测试/etc/init.d/mysql start mysql -u root -p

© 2026 海能知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com