MySQL Reset password and remote connection permissions issues

Source: Internet
Author: User

If MySQL does not have a password, or if the password is set to empty, you can open cmd as an administrator, then enter mysqladmin-u root password 123456 The password for this place is the plaintext password.

If you forget the root password for MySQL, you can reset it in the following ways:
  
1. Kill the MySQL process in the system by doing the following:
A. Click the Desktop toolbar to open the taskbar manager.
b, from the Task Manager process to find the Mysqld.exe process, right-click to select the end process.
2. Enter the command at the command line mysqld--skip-grant-tables start MySQL and start it without checking permissions;
3. Then open a window, with a blank password to use the root user login to MySQL;
4. Change the password of the root user;
mysql> Update Mysql.user Set Password=password (' New password ') where user= ' root ';
mysql> flush Privileges;
Mysql> quit
5. Restart MySQL to log in with the new password

Set permissions for the remote Access database: Set the permissions that can be accessed by the root user of all hosts, and the password for the database is 123456

GRANT all privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with GRANT OPTION;

If you want to allow user root to connect to the MySQL server from a host with IP 192.168.1.3, and use MyPassword as the password

GRANT all privileges on * * to ' root ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OPTION;

Remote connection to database directive mysql-h remote host name-U root-p

If the connection is unsuccessful, turn off the firewall

MySQL Reset password and remote connection permissions issues

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.