更改SQL的root密码

时间:2015-11-09 16:22:56

标签: sql sql-server linux windows-server-2008 snort

所以我正在运行一个Linux盒子以及WindowsServer2008。现在我正在尝试安装barnyard在我的linux机器上工作,但我陷入了linux请求我的SQL root密码的过程中的一部分。这可能是一个愚蠢的问题,但我很难找到我要更改SQL帐户密码的位置。 WS2008服务器和Linux都是近乎全新的安装,但它们分别只有snort和MSSQL。任何帮助将不胜感激。谢谢!!

1 个答案:

答案 0 :(得分:0)

这应该在Linux上完成:

#Stop mysql service
service mysql stop (RHEL based OS)
service mysqld stop (Debian based OS)

#Start mysql in safe mode:
mysqld_safe --skip-grant-tables &

#Log into mysql as root (No password is required)
mysql -uroot

#Select "mysql" database (where we need to make changes)
use mysql;

#Reset Password mynewpassword should be changed with password you wish to have
update user set password=PASSWORD("mynewpassword") where User='root';

#Flush privileges
flush privileges;

#Quit from mysql
quit

#Restart mysql service as normal mode
service mysql restart (RHEL based OS)
service mysqld restart (Debian based OS)