栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何将root密码设置为null

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何将root密码设置为null

您可以通过以下五个简单步骤来恢复MySQL数据库服务器密码。

步骤1 :停止MySQL服务器进程。

步骤#2 :使用–skip-grant-tables选项启动MySQL(mysqld)服务器/守护进程,以使其不提示输入密码。

步骤#3 :以root用户身份连接到mysql服务器。

步骤4 :设置新的mysql根帐户密码,即重置mysql密码。

步骤5 :退出并重新启动MySQL服务器。

这是您需要为每个步骤键入的命令(以root用户身份登录):

步骤#1 :停止mysql服务

# /etc/init.d/mysql stop

输出:

Stopping MySQL database server: mysqld.

步骤2 :启动没有密码的MySQL服务器:

# mysqld_safe --skip-grant-tables &

输出:

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

步骤#3 :使用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-logType 'help;' or 'h' for help. Type 'c' to clear the buffer.mysql>

步骤#4 :设置新的MySQL root用户密码

mysql> use mysql;mysql> update user set password=PASSWORd("NEW-ROOT-PASSWORD") where User='root';mysql> flush privileges;mysql> quit

步骤#5 :停止MySQL服务器:

# /etc/init.d/mysql stop

输出:

Stopping MySQL database server: mysqldSTOPPING server from pid file /var/run/mysqld/mysqld.pidmysqld_safe[6186]: ended[1]+  Done         mysqld_safe --skip-grant-tables

步骤#6 :启动MySQL服务器并进行测试

# /etc/init.d/mysql start# mysql      ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) # mysql -u root -p

资料来源:http :
//www.cyberciti.biz/tips/recover-mysql-root-
password.html



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/402742.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号