MySQL 5.6 root password is missing

Source: Internet
Author: User
Tags mysql login

The MySQL password under Windows forgot

Step One: Netstat-nat (you can see if MySQL is up, and if it starts, you can use input net stop MySQL (or end the process through Task Manager))

Step two: Mysqld--skip-grant-tables, do not close the window

Step three: Open a new cmd, and then enter Mysql-uroot-p return, enter the password when you press the ENTER key directly

Fourth Step: Change Password: update mysql.user Set password = password ("123456") where user= "root";

Fifth Step: Refresh Password: flush privileges;

Sixth step: Quit: Exit, then you can re-login with the new password

mysql password under Linux forgot:

1. First verify that the server is in a secure state, that is, no one can connect to the MySQL database arbitrarily.
Because the MySQL database is completely password-protected during the reset of the root password of MySQL
Status, other users can also log in and modify MySQL information arbitrarily. MySQL can be used to
and stop Apache and all user processes to implement the server's quasi-security
State. The safest state is to operate on the console of the server and unplug the network cable.
2. To modify the login settings for MySQL:
#vi/etc/my.cnf
Add a sentence to the paragraph in [mysqld]: Skip-grant-tables
For example:
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
Skip-grant-tables
Save and Exit VI.
3. Restart Mysqld
#/etc/init.d/mysqld Restart
stopping MySQL: [OK]
Starting MySQL: [OK]
4. Log in and modify the root password of MySQL
#/usr/bin/mysql-uroot-p
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 3 to server version:3.23.56
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the buffer.
Mysql>Use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a
Database changed
Mysql>UPDATE user SET Password = Password (' New-password ') WHERE user = ' root ';
Query OK, 0 rows Affected (0.00 sec)
Rows matched:2 changed:0 warnings:0
Mysql>flush Privileges;
Query OK, 0 rows affected (0.01 sec)
Mysql>quit
Bye
5. Change MySQL login settings back
#vi/etc/my.cnf
Delete the skip-grant-tables you just added in the paragraph [mysqld]
Save and Exit VI.
6. Restart Mysqld
#/etc/init.d/mysqld Restart
stopping MySQL: [OK]
Starting MySQL: [OK]

MySQL Settings no password login:

Under Windows is to find the MySQL configuration file My.ini (Linux is to find/etc/my.cnf), and then add skip-grant-tables under [mysqld], so you don't need a password to log in to MySQL later

View the MySQL version

Method One: Can be used: mysql-v, you can view the MySQL information

Method Two: After logging in to MySQL, enter: status

Shared1 accessories, 0.26MB Download all accessories
    • mccoo 20142108211530185.jpg 265KB Download Preview

MySQL 5.6 root password is missing

Related Article

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.