Download the latest version of Ubuntu Linux dedicated MySQL on the MySQL official website. What I'm downloading here is:
Mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar
You can also download it from the following mirrors:
http://mirrors.sohu.com/mysql/MySQL-5.7/
The Unzip file command is:
[Email protected]:/# tar-zxvf mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar-c./opt/
After unpacking, a total of 11 deb packages, with the sudo dpkg-i [package name] command to install each, because there is a dependency between package and package, there is a sequence of installation.
- -rw-r--r--1 7155 31415 841472 Nov 05:50 libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 1189512 Nov 05:50 libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 17383814 Nov 05:50 libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 12644 Nov 05:50 mysql-client_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 71282 Nov 05:50 mysql-common_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 6815 Nov 05:50 mysql-community_5.7.17-1ubuntu16.04_amd64.changes
- -rw-r--r--1 7155 31415 7357222 Nov 05:50 mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 24698654 Nov 05:50 mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 133305884 Nov 05:50 mysql-community-source_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 23384678 Nov 05:50 mysql-community-test_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 12636 Nov 05:50 mysql-server_5.7.17-1ubuntu16.04_amd64.deb
- -rw-r--r--1 7155 31415 12652 Nov 05:50 mysql-testsuite_5.7.17-1ubuntu16.04_amd64.deb
The order of my installation is:
1.mysql-common_5.7.17-1ubuntu16.04_amd64.deb
2.libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb
3.libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb
4.libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb
5.mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb
6.mysql-client_5.7.17-1ubuntu16.04_amd64.deb
7.mysql-community-source_5.7.17-1ubuntu16.04_amd64.deb
Here you need to install a dependent package called libmecab2, after installation, continue to install the last one:
8.mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
The database password needs to be set during installation.
Here, all of them have been installed. Input mysql-u root-p can log into the database.
MySQL Simple installation method:
1. sudo apt-get install Mysql-server
2. Apt-get Isntall mysql-client
3. sudo apt-get install Libmysqlclient-dev
During installation, you will be prompted to set a password or something, note that the settings do not forget that after the installation is complete, you can use the following command to check if the installation is successful:
sudo netstat-tap | grep MySQL
After checking with the above command, if you see a socket with MySQL in the Listen state, the installation is successful.
Log in to MySQL database by the following command:
Mysql-u root-p
-U means to select the login user name,-p indicates the login user password, the above command input will prompt for a password, then enter the password can log in to MySQL.
then through show databases; You can view the current database.
We choose the MySQL database on the line next, using the use MySQL command, display the current database form: show tables;
How to execute SQL script under MySQL
- mysql> CREATE DATABASE MyDatabase;
- Query OK, 1 row affected (0.00 sec)
- mysql> use MyDatabase;
- Database changed
- Mysql> source./mysql.sql
- Query OK, 0 rows affected, 1 Warning (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.33 sec)
- Records: 0 Duplicates: 0 Warnings: 0
- Query OK, 0 rows affected, 1 Warning (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected, 1 Warning (0.00 sec)
- Query OK, 0 rows affected (0.04 sec)
- Query OK, 0 rows affected, 1 Warning (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Mysql> Show tables;
DPKG Installation problems:
Software dependency issues when installing MySQL server:
Mysql-community-server depends on AppArmor; However:
Package AppArmor are not installed.
Mysql-community-server depends on libmecab2 (>= 0.996-1.2ubuntu1); However:
Package libmecab2 are not installed.
Then install it first:
sudo apt-get install LIBMECAB2
Then Mysql-community-server,mysql-server will be able to use it normally.
Installing any software under Ubuntu prompts for the following error:
You might want-to-run ' apt-get-f install ' to correct these:
The following packages has unmet dependencies:
KATE:DEPENDS:KDELIBS4C2A (>= 4:3.5.9) but it isn't going to be installed
DEPENDS:LIBQT3-MT (>= 3:3.3.8b) but it isn't going to be installed
Recommends:kregexpeditor but it's not installable
KSCOPE:DEPENDS:KDELIBS4C2A (>= 4:3.5.7-1) but it isn't going to be installed
Depends:libaudio2 but it isn't going to being installed
DEPENDS:LIBQT3-MT (>= 3:3.3.8really3.3.7) but it isn't going to be installed
Depends:cscope but it isn't going to being installed
Depends:exuberant-ctags but it isn't going to being installed
Depends:graphviz but it isn't going to being installed
E:unmet dependencies. Try ' apt-get-f install ' with no packages (or specify a solution).
Workaround:
Remove the hints for Kate and kscope two not fully installed software.
$sudo dpkg--purge Kate
$sudo dpkg--purge Kscope
Ubuntu 16.04 Installation mysql-server_5.7.17