修改mysql数据库密码

主机相关 admin 547℃ 0评论

1) Make sure the root mysql password works.  If you know it, skip to 2). The mysql root password can be found in the /usr/local/directadmin/scripts/setup.txt if it has not been deleted.  It’s under the header “mysql=”.  If it cannot be found, then mysqld will have to be restarted with the –skip-grant-tables option (this guide is for Redhat/CentOS):

/etc/init.d/mysqld stop
mysqld_safe –skip-grant-tables &

That should start up mysql without the need for a root password.  Once in, type

use mysql
UPDATE mysql.user SET password=PASSWORD(‘1OycBr740l‘) WHERE user=’root';
FLUSH PRIVILEGES;
quit

That will reset the root password for you.

Type “killall -9 mysqld_safe; killall -9 mysqld” to shut down mysqld.
Start it up again with

/etc/init.d/mysqld start

 

转载请注明:主机优惠吧 » 修改mysql数据库密码

喜欢 (0)

您必须 登录 才能发表评论!