There are many ways to install it, and here you choose to install it using apt.
The main reference documents are official documents: https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install
Here is just a simple explanation: (The following is the root user operation, if it is other, the previous need to input sudo)
1. Uninstall all MySQL-related files. (This step is required if the previous load failed.)
apt-get purge mysql*
Enter Y to continue.
2. Installing dependent libraries
apt-Cache Search Libaio # find apt-get install Libaio1 # Installation
3. Download Apt Library and install
- Download to official website: http://dev.mysql.com/downloads/repo/apt/. Well, just one file.
- Execute the following command:
Dpkg-i Mysql-apt-config_w.x.y-z_all.deb
Mysql-apt-config_w. xy-z_all. Deb is your next. deb file
- During the installation process you will encounter the server and other tools that you choose to install, by default, (two-time carriage return, then choose the OK option)
4. Perform apt-get update
apt-Get update
5. When finished, install Mysql-server
apt-get Install Mysql-server
The installation process will prompt for MySQL password two times.
6. View status (optional)
Service MySQL Status
7. Stop/Start service (optional)
Service MySQL stopservice MySQL start
Ubuntu16.04 installation MySql5.7