Resetting the MySQLroot password in Linux

Source: Internet
Author: User
1. Stop MySQL Service Execution: etcinit. dmysqlstop on your machine may not be etcinit. dmysql, or etcinit. dmysqld2. skip verification to start MySQLusrlocalmysqlbinmysqld_safe -- skip

1. Stop MySQL Service Execution:/etc/init. d/mysql stop is not necessarily/etc/init on your machine. d/mysql, or/etc/init. d/mysqld 2. skip verification to start MySQL/usr/local/mysql/bin/mysqld_safe -- skip-grant-tables/dev/null 2 1 Note: If mysqld_s

1. Stop the MySQL Service
Run:

/Etc/init. d/mysql stop

Not necessarily/etc/init. d/mysql on your machine, or/etc/init. d/mysqld

2. Skip verification to start MySQL

/Usr/local/mysql/bin/mysqld_safe -- skip-grant-tables>/dev/null 2> & 1 &

Note: If the location of mysqld_safe is different from above, you need to change it to yours. If you are not clear about it, you can use the find command to find it.

3. Reset the password
Wait for a while and then execute:

/Usr/local/mysql/bin/mysql-u root mysql

Enter:

Update user set password = Password ('password to set') where User = 'root ';

Press enter and execute:

Flush privileges;

Refresh the table related to MySQL system permissions. Run the following command:

Exit;

Exit.

4. Restart MySQL
Kill the MySQL process:

Killall mysqld

Restart MySQL:

/Etc/init. d/mysql start

Original article address: reset the MySQL root Password in Linux. Thank you for sharing it with me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.