Graphic tutorial on installation and configuration method of mysql5.7. 17 under Linux of Ubuntu
- 2021-07-01 08:21:46
- OfStack
Preface
mysql 5.6 has been installed before. After 3 months, the development feedback needs to process JSON data in MySQL and check the documents. JSON is a new feature supported in 5.7. So we set out to install Mysql57
Installation of Mysql5.6. 28://www.ofstack.com/article/103743. htm
Installation
If you use apt-get install mysql-server for installation, the default installation is not the latest version, so consider going to official website to find the latest community version.
1. Get the latest version of Mysql
Select the operating system version (Ubuntu in this case) under https://dev. mysql. com/downloads/mysql/, and pay attention to match the operating system version when downloading (OS version corresponds to the installation package version).
# cat /etc/issue
Ubuntu 12.04.5 LTS \n \l
# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-server_5.7.17-1ubuntu12.04_amd64.deb-bundle.tar
2. Specific installation (pay attention to the installation order because of the dependence report)
# tar -xvf mysql-server_5.7.17-1ubuntu12.04_amd64.deb-bundle.tar
# ll
total 712948
drwxr-xr-x 2 root root 4096 Jan 20 10:07 ./
drwxr-xr-x 5 root root 4096 Jan 19 19:23 ../
-rw-r--r-- 1 7155 31415 1356802 Nov 29 03:30 libmysqlclient20_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 1904116 Nov 29 03:30 libmysqlclient-dev_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 30791660 Nov 29 03:29 libmysqld-dev_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 12998 Nov 29 03:30 mysql-client_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 82798 Nov 29 03:30 mysql-common_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 6831 Nov 29 03:30 mysql-community_5.7.17-1ubuntu12.04_amd64.changes
-rw-r--r-- 1 7155 31415 21519804 Nov 29 03:30 mysql-community-client_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 55477882 Nov 29 03:29 mysql-community-server_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 208582030 Nov 29 03:30 mysql-community-source_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 45244026 Nov 29 03:30 mysql-community-test_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 12990 Nov 29 03:30 mysql-server_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 root root 365015040 Nov 30 02:11 mysql-server_5.7.17-1ubuntu12.04_amd64.deb-bundle.tar
-rw-r--r-- 1 7155 31415 13014 Nov 29 03:30 mysql-testsuite_5.7.17-1ubuntu12.04_amd64.deb
### Install dependency packages
sudo apt-get upgrade
sudo apt-get install libaio1
### Installation deb Bag
sudo dpkg -i mysql-common_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-client_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-community-source_5.7.17-1ubuntu12.04_amd64.deb
###libmecab2 Installation
sudo apt-get -f install
sudo dpkg -i mysql-community-server_5.7.17-1ubuntu12.04_amd64.deb
### You will be prompted to set up here root Password
Basic configuration (different from previous version 5.6)
1. Add users and empower them
create user testuser identified by '*******';
create database testdb;
GRANT ALL ON testdb.* TO 'testuser'@'%' ;
flush privileges;
--root User remote access rights are open
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user from user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | testuser |
| localhost | mysql.sys |
| localhost | root |
+-----------+-----------+
3 rows in set (0.00 sec)
mysql> update user set host = '%' where user ='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | testuser |
| % | root |
| localhost | mysql.sys |
+-----------+-----------+
3 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
2. Configuration file modification
Configuration file path (changed from previous version, 56 path:/etc/MySQL/my. conf)
57 Path:/etc/mysql/mysql. conf. d/mysqld. cnf
--Bind IP modifications
Find line bind-address = 127.0. 0.1
Change to bind-address = 0.0. 0.0, problem solved.
--Case-sensitive modifications
After [mysqld], add lower_case_table_names=1 and restart MYSQL service. At this time, it has been set successfully: the case of the table name is insensitive;
Detailed explanation of lower_case_table_names parameters:
lower_case_table_names = 0
Where 0: case-sensitive, 1: case-insensitive
Others
The basic service start-stop command has not changed
# Start MySQL$ sudo service mysql start
# Shut down MySQL$ sudo service mysql stop
# Restart MySQL$ sudo service mysql restart
# Other orders: $ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart
Wonderful topic sharing:
Installation tutorials for different versions of mysql
mysql 5.6 Versions Installation Tutorial
mysql 5.7 Versions Installation Tutorial
mysql 8.0 Version Installation Tutorial