MySQL has no password by default. Enter mysql-u root to enter MySQL.
1. initialize the root password
Enter the MySQL database
Mysql> Update user SET Password = PASSWORD ('000000') where user = 'root ';
2. To allow remote access to MySQL, you can use the following three methods:
A. Change the table.
Mysql-u root-pmysql> use MySQL; mysql> Update user set host = '%' where user = 'root'; mysql> select host, user from user;
B. Authorization.
For example, you want the root user to use 123456 to connect to the MySQL server from any host.
Mysql> grant all privileges on *. * To 'root' @ '%' identified by '000000' with grant option;
If you want to allow Jack to connect to the MySQL server from a host with IP address 10.10.50.127 and use 654321 as the password
Mysql> grant all privileges on *. * To 'jack' @ '10. 10.50.127 'identified by '000000' with grant option; mysql> flush rivileges
C: run the following command on the machine where MySQL is installed:
// Enter MySQL Server D: \ mysql \ bin \> mysql-H localhost-u root // grant any host the permission to access data mysql> grant all privileges on *. * To 'root' @ '%' with grant option // make the modification take effect mysql> flush privileges // exit MySQL Server mysql> exit