MySQL 5.7.17 installation and configuration method graphic tutorial (Ubuntu 16.04)

MySQL 5.7.17 installation and configuration method graphic tutorial (Ubuntu 16.04)

Download the latest version of MySQL for Ubuntu Linux from the official MySQL website. Here is what I downloaded:

mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar

It can also be downloaded from the following mirrors:

http://mirrors.sohu.com/mysql/MySQL-5.7/

The command to decompress the file is:

Copy the code as follows:
root@ubuntu:/fly/mysql# tar -xvf ../mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar -C ./

After decompression, there are 11 deb packages in total. Use the sudo dpkg -i [package name] command to install them one by one. Because there are dependencies between packages, there is a sequence of installation.

-rw-r--r-- 1 7155 31415 841472 Nov 28 05:50 libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 1189512 Nov 28 05:50 libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 17383814 Nov 28 05:50 libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 12644 Nov 28 05:50 mysql-client_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 71282 Nov 28 05:50 mysql-common_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 6815 Nov 28 05:50 mysql-community_5.7.17-1ubuntu16.04_amd64.changes
-rw-r--r-- 1 7155 31415 7357222 Nov 28 05:50 mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 24698654 Nov 28 05:50 mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 133305884 Nov 28 05:50 mysql-community-source_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 23384678 Nov 28 05:50 mysql-community-test_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 12636 Nov 28 05:50 mysql-server_5.7.17-1ubuntu16.04_amd64.deb
-rw-r--r-- 1 7155 31415 12652 Nov 28 05:50 mysql-testsuite_5.7.17-1ubuntu16.04_amd64.deb

My installation order 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 another dependency package called libmecab2 . After installing it, continue to install the last one:
8.mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
You need to set a database password during the installation process.
At this point, everything has been installed. Enter Mysql -u root -p to log in to the database.

root@ubuntu:/fly/mysql# dpkg -i mysql-common_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading mysql-common from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack mysql-common_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking mysql-common (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up mysql-common (5.7.17-1ubuntu16.04) ...
root@ubuntu:/fly/mysql# dpkg -i libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading libmysqlclient20:amd64 from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking libmysqlclient20:amd64 (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up libmysqlclient20:amd64 (5.7.17-1ubuntu16.04) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
root@ubuntu:/fly/mysql# dpkg -i libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading libmysqlclient-dev from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking libmysqlclient-dev (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up libmysqlclient-dev (5.7.17-1ubuntu16.04) ...
Processing triggers for man-db (2.7.5-1) ...
root@ubuntu:/fly/mysql# dpkg -i libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading libmysqld-dev from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking libmysqld-dev (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up libmysqld-dev (5.7.17-1ubuntu16.04) ...
root@ubuntu:/fly/mysql# dpkg -i mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading mysql-community-client from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking mysql-community-client (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up mysql-community-client (5.7.17-1ubuntu16.04) ...
Processing triggers for man-db (2.7.5-1) ...
root@ubuntu:/fly/mysql# dpkg -i mysql-client_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading mysql-client from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack mysql-client_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking mysql-client (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up mysql-client (5.7.17-1ubuntu16.04) ...
root@ubuntu:/fly/mysql# dpkg -i mysql-community-source_5.7.17-1ubuntu16.04_amd64.deb
dpkg: warning: downgrading mysql-community-source from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack mysql-community-source_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking mysql-community-source (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...
Setting up mysql-community-source (5.7.17-1ubuntu16.04) ...
root@ubuntu:/fly/mysql# dpkg -i mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
Selecting previously unselected package mysql-community-server.
(Reading database ... 212644 files and directories currently installed.)
Preparing to unpack mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb ...
Unpacking mysql-community-server (5.7.17-1ubuntu16.04) ...
Setting up mysql-community-server (5.7.17-1ubuntu16.04) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Processing triggers for systemd (229-4ubuntu13) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
root@ubuntu:/fly/mysql# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

Simple installation method of mysql:

1. sudo apt-get install mysql-server

2. apt-get isntall mysql-client

3. sudo apt-get install libmysqlclient-dev

During the installation process, you will be prompted to set a password or something. Be careful not to forget it. After the installation is complete, you can use the following command to check whether the installation is successful:

sudo netstat -tap | grep mysql

After checking with the above command, if you see that the mysql socket is in the listening state, it means the installation is successful.

You can log in to the MySQL database using the following command:

mysql -u root -p

-u means selecting the login username, -p means the login user password. After entering the above command, you will be prompted to enter the password. At this time, enter the password to log in to MySQL.

Then you can view the current database through show databases;

We select the MySQL database and proceed to the next step. Use the use mysql command to display the current database table: show tables

How to execute sql scripts in 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; 

Problems with dpkg installation:

Software dependency issues when installing MySQL server:
mysql-community-server depends on apparmor; however:
Package apparmor is not installed.
mysql-community-server depends on libmecab2 (>= 0.996-1.2ubuntu1); however:
Package libmecab2 is not installed.
Then install it first:
sudo apt-get install libmecab2
Then mysql-community-server and mysql-server can be used normally.

When installing any software under Ubuntu, the following error message appears:

You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
kate : Depends: kdelibs4c2a (>= 4:3.5.9) but it is not going to be installed
Depends: libqt3-mt (>= 3:3.3.8b) but it is not going to be installed
Recommends: kregexpeditor but it is not installable
kscope : Depends: kdelibs4c2a (>= 4:3.5.7-1) but it is not going to be installed
Depends: libaudio2 but it is not going to be installed
Depends: libqt3-mt (>= 3:3.3.8really3.3.7) but it is not going to be installed
Depends: cscope but it is not going to be installed
Depends: exuberant-ctags but it is not going to be installed
Depends: graphviz but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Solution:

Delete the two incompletely installed softwares, kate and kscope.

 $ sudo dpkg --purge kate
 $ sudo dpkg --purge kscope

Wonderful topic sharing: Installation tutorials for different versions of MySQL Installation tutorials for MySQL 5.7 versions Installation tutorials for MySQL 5.6 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 tutorial under Linux (Ubuntu)
  • Detailed tutorial on installing and configuring MySql5.7 on Ubuntu 20.04

<<:  WeChat applet Amap multi-point route planning process example detailed explanation

>>:  js to achieve interesting countdown effect

Recommend

Implementation of Nginx configuration of local image server

Table of contents 1. Introduction to Nginx 2. Ima...

Detailed tutorial on deploying SpringBoot + Vue project to Linux server

Preface Let me share with you how I deployed a Sp...

How to use boost.python to call c++ dynamic library in linux

Preface Recently I started using robot framework ...

Several implementation methods of the tab bar (recommended)

Tabs: Category + Description Tag bar: Category =&...

mysql5.7.21 utf8 encoding problem and solution in Mac environment

1. Goal: Change the value of character_set_server...

MySQL view principles and basic operation examples

This article uses examples to illustrate the prin...

A brief discussion on logic extraction and field display of Vue3 in projects

Table of contents Logical Layering Separate busin...

...

Select web page drop-down list and div layer covering problem

Questions about select elements in HTML have been...

How to set up automatic daily database backup in Linux

This article takes Centos7.6 system and Oracle11g...

WeChat applet scroll-view realizes left and right linkage

This article shares the specific code for WeChat ...

5 super useful open source Docker tools highly recommended

Introduction The Docker community has created man...