Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Friday, January 15, 2010

Reset Password on Mysql

1. we first used to turn off the server, the server did not mean a whole but only mysql service. hehehe …
of course, is how to turn them off from the root linux via the command:
# /etc/init.d/mysql stop

2. then create a sql script to change the password with the command
# vi /root/mysql.reset.sql
or with other commands you like such as pico or nano .
write or fill in the following script:
mysql.user UPDATE SET Password = PASSWORD ( 'my_password') WHERE User = 'root';
GRANT ALL ON *.* TO 'root';
FLUSH PRIVILEGES;

and then save it.

3. sql script is run with the command:
# mysqld_safe --init-file=/root/mysql.reset.sql &
do not forget the “&” in the script terserbut. ok?
then there will be output:
#nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[20970]: started

or:
100116 11:00:28 mysqld_safe Logging to '/var/log/mysql/mysqld.log'.
100116 11:00:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
100116 11:00:30 mysqld_safe mysqld from pid file /var/lib/mysql/linux-vb3s.site.pid ended

press enter.

4. restart mysql server
# /etc/init.d/mysql start