MySQL 5.7.17 installation and configuration tutorial under Linux (Ubuntu)

MySQL 5.7.17 installation and configuration tutorial under Linux (Ubuntu)

Preface

I have installed MySQL 5.6 before. Three months later, the developers reported that they need to process JSON data in MySQL. After checking the documentation, I found that JSON is a new feature supported in 5.7. So I started to install Mysql57
Installation of Mysql5.6.28: //www.jb51.net/article/103743.htm

Install

If you use apt-get install mysql-server to install, the default version installed is not the latest version, so consider going to the official website to find the latest community version.

1. Get the latest MySQL version

Select the operating system version (Ubuntu in this case) at https://dev.mysql.com/downloads/mysql/. When downloading, make sure it matches the operating system version (the 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 (due to the dependency report, you need to pay attention to the installation order)

# 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 dependent packagessudo apt-get upgrade
sudo apt-get install libaio1
###Install the deb package 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 installationsudo apt-get -f install 
sudo dpkg -i mysql-community-server_5.7.17-1ubuntu12.04_amd64.deb

###You will be prompted to set the root password

Basic configuration (different from the previous 5.6 version)

1. Add new users and empower them

create user testuser identified by '*******';
create database testdb;
GRANT ALL ON testdb.* TO 'testuser'@'%';
flush privileges;

--Open remote access rights for root user 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 versions, 56 path: /etc/MySQL/my.conf)
57 Path: /etc/mysql/mysql.conf.d/mysqld.cnf

--Bind IP modification. Find the line bind-address = 127.0.0.1 and change it to bind-address = 0.0.0.0. The problem is solved.
--Case-sensitive modification
Add lower_case_table_names=1 after [mysqld], restart the MYSQL service, and the setting is successful: table names are not case sensitive;
Detailed explanation of the lower_case_table_names parameter:
lower_case_table_names = 0
0: case sensitive, 1: case insensitive

other

The basic service start and stop commands have not changed

# Start MySQL$ sudo service mysql start 
# Shut down MySQL$ sudo service mysql stop
# Restart MySQL$ sudo service mysql restart
# Other commands: $ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart

Wonderful topic sharing:

MySQL different versions installation tutorial

MySQL 5.6 installation tutorials for various versions

MySQL 5.7 installation tutorials for various versions

mysql8.0 installation tutorials for various versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Ubuntu 18.04 installs mysql 5.7.23
  • Install MySQL 5.7 on Ubuntu 18.04
  • Ubuntu16.04 installation mysql5.7.22 graphic tutorial
  • Solve the problem of ERROR 1045 (28000): Access denied for user ''root''@''localhost'' when logging in after installing MySQL 5.7.17 on Ubuntu 16.04
  • Manually install mysql5.7.10 on Ubuntu
  • MySQL 5.7.17 installation and configuration method graphic tutorial (Ubuntu 16.04)
  • Detailed tutorial on installing and configuring MySql5.7 on Ubuntu 20.04

<<:  Detailed explanation of Linux file operation knowledge points

>>:  Vue uses filters to format dates

Recommend

CSS to achieve text on the background image

Effect: <div class="imgs"> <!-...

Simple example of HTML checkbox and radio style beautification

Simple example of HTML checkbox and radio style b...

JavaScript Closures Explained

Table of contents 1. What is a closure? 2. The ro...

How to configure ssh to log in to Linux using git bash

1. First, generate the public key and private key...

How to cancel the background color of the a tag when it is clicked in H5

1. Cancel the blue color of the a tag when it is ...

Understanding and using React useEffect

Table of contents Avoid repetitive rendering loop...

SQL Practice Exercise: Online Mall Database Product Category Data Operation

Online shopping mall database-product category da...

Notes on MySQL case sensitivity

Table of contents MySQL case sensitivity is contr...

Explanation of the execution priority of mySQL keywords

As shown below: from table where condition group ...

Detailed explanation of using split command to split Linux files

A few simple Linux commands let you split and rea...

Vue+flask realizes video synthesis function (drag and drop upload)

Table of contents We have written about drag and ...

Vue3 list interface data display details

Table of contents 1. List interface display examp...