
Linux系统下忘记MySql密码怎么办
1个回答
展开全部
linux忘记mysql密码处理方法:
# /etc/init.d/mysql stop
# mysqld_safe
--user=mysql --skip-grant-tables --skip-networking &
# mysql -u root
mysql
mysql> update user set password=password('newpassword') where
user='root';
mysql> flush privileges;
mysql> quit
#
/etc/init.d/mysql restart
# mysql -uroot -p
enter password:
<输入新设的密码newpassword>
mysql>
修改的用户都以root为列。
一、拥有原来的myql的root的密码;
方法一:
在mysql系统外,使用mysqladmin
# mysqladmin -u root -p password
"test123"
Enter password: 【输入原来的密码】
方法二:
通过登录mysql系统,
# mysql -uroot -p
Enter password:
【输入原来的密码】
mysql>use mysql;
mysql> update user set
password=passworD("test") where user='root';
mysql> flush
privileges;
mysql> exit;
方法三:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql
--skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where
USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql
restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql> grant all on *.* to root@'%' identified by '密码';
方法四:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql
-udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql>
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
# /etc/init.d/mysql stop
# mysqld_safe
--user=mysql --skip-grant-tables --skip-networking &
# mysql -u root
mysql
mysql> update user set password=password('newpassword') where
user='root';
mysql> flush privileges;
mysql> quit
#
/etc/init.d/mysql restart
# mysql -uroot -p
enter password:
<输入新设的密码newpassword>
mysql>
修改的用户都以root为列。
一、拥有原来的myql的root的密码;
方法一:
在mysql系统外,使用mysqladmin
# mysqladmin -u root -p password
"test123"
Enter password: 【输入原来的密码】
方法二:
通过登录mysql系统,
# mysql -uroot -p
Enter password:
【输入原来的密码】
mysql>use mysql;
mysql> update user set
password=passworD("test") where user='root';
mysql> flush
privileges;
mysql> exit;
方法三:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql
--skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where
USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql
restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql> grant all on *.* to root@'%' identified by '密码';
方法四:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql
-udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql>
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |