MySQL initializes the root password and allows remote access

Source: Internet
Author: User

1. Initialize root password

Go to MySQL Database

mysql>updateuser setpassword=PASSWORD(‘123456’) whereUser=‘root‘;

To allow MySQL remote access, you can use the following three ways:

A, change the table.

1234 mysql-u root–p mysql>use MySQL; MYSQL> update  user   set  host =   where  user  =  MYSQL> select  HOST,  user  from   User

b, Authorization.

For example, you want to use root 123456 from any host to connect to the MySQL server.

mysql>GRANTALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIEDBY ‘123456‘ WITH GRANTOPTION;

If you want to allow the user jack to connect to the MySQL server from the IP-10.10.50.127 host and use 654321 as the password

mysql>GRANTALL PRIVILEGES ON *.* TO ‘jack‘@’10.10.50.127’ IDENTIFIED BY ‘654321‘ WITH GRANTOPTION;mysql>FLUSH RIVILEGES

C: Run on the machine where MySQL is installed:

12345678 //into MySQL server d:\mysql\bin\>mysql-h localhost-u root //give any host access to data Code class= "SQL Plain" >MYSQL> grant  all  privileges  on  *.*  to   ' root ' @ '% '  with  grant option //make the modification effective MYSQL>FLUSH  privileges //exiting the MySQL server mysql>exit

MySQL initializes the root password and allows remote access

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.