1. Install MySQL
Sudo apt-get install mysql-server
2. Modify the MYSQL root user password
After the default MySQL installation, the root user does not have a password. Therefore, use the root user to enter:
$ Mysql-u root-p
Mysql> use mysql; update user set password = PASSWORD ('panpan') where user = 'root'; flush privileges;
Change password to panpan
3. Modify the remote access permission of the MYSQL root user
First, modify the configuration file sudo vim/etc/mysql/my. cnf.
Bind-address = 127.0.0.1 => bind-address = IP address of your machine
Restart mysql
Sudo/etc/init. d/mysql restart
Log on to mysql from the local machine: mysql-u root-p
Then enter the password panpan
Use mysql;
Grant all privileges on. to root @ "%" identified by "panpan" with grant option; flush privileges;
Enter the mysql database to check whether the data with host % is added: use mysql; select * from user;
In this way, you can use navicat to log on to 3306/192 .168.1.21/root/panpan.
4. Add a new user panyingyun and create a database mame so that it can only access the mame database
Log on to mysql from the local machine: mysql-u root-p
Mysql> create database mame;
Mysql> grant all privileges on mame. * to panyingyun @ "%" identified by "panpan" with grant option; flush privileges;
In this way, you can use navicat to log on to 3306/192 .168.1.21/panyingyun/panpan.