Ubuntu Server 16.04 installation MySQL
1. Use the root account
sudo apt-get install Mysql-server
Apt-get Isntall mysql-client
Apt-get Install Libmysqlclient-dev
If there is a problem in the middle, perform the following apt-get update
2. After the installation of the above 3 packages, use the following command to query whether the installation was successful:
sudo netstat-tap | grep MySQL
The query results, as shown, indicate that the installation was successful.
[Email protected]:~# Netstat-tap | grep MySQL
TCP6 0 0 [::]:mysql [::]:* LISTEN 7510/mysqld
[Email protected]:~#
Second, set up MySQL remote access
1. Edit the MySQL configuration file, and put the bind-address = 127.0.0.1 comment
Vi/etc/mysql/my.cnf
2. Use root to enter the MySQL command line, execute the following 2 commands, example of MySQL root account password: root
[Email protected]:~# mysql-uroot-proot
Mysql>grant all on * * to [email protected] '% ' identified by ' root ' with grand option;
*. *: The first * represents the database name; the second * represents the table name. This means that all tables in the database are licensed to the user. Root: Grant root account. "%": indicates that the authorized user IP can be specified, which means that any IP address can access the MySQL database. "Password": Assign the password of the account, here the password itself is replaced with your MySQL root account password.
Mysql>flush privileges;
Refresh the permission information, that is, let the settings we make take effect immediately.
3. Restart MySQL
/etc/init.d/mysql restart
Ubuntu Server 16.04 installs MySQL and sets up remote access