Install mysql5.7 on Ubuntu 18.04

Install mysql5.7 on Ubuntu 18.04

Ubuntu 18.04 installs mysql 5.7 for your reference. The specific contents are as follows

1.1 Installation

First execute the following three commands:

# Install mysql service sudo apt-get install mysql-server
# Install the client sudo apt install mysql-client
# Install dependencies sudo apt install libmysqlclient-dev
# Check the status sudo netstat -tap | grep mysql

1.2 Set root password

After mysql5.7 is installed, ordinary users cannot enter mysql. The reason is: the root plugin has been changed to auth_socket. The plugin for logging in with a password should be mysql_native_password. Log in directly with root privileges without a password. Change the root password and login verification method:

$ sudo su
#mysql
mysql>
mysql> select user, plugin from mysql.user;
+------------------+-----------------------+
| user | plugin |
+------------------+-----------------------+
| root | auth_socket |
| mysql.session | mysql_native_password |
| mysql.sys | mysql_native_password |
| debian-sys-maint | mysql_native_password |
+------------------+-----------------------+
4 rows in set (0.00 sec)
mysql> update mysql.user set authentication_string=PASSWORD('123456'), plugin='mysql_native_password' where user='root';
mysql> flush privileges;
mysql> exit
Bye
# exit
$ sudo /etc/init.d/mysql restart
$ mysql -uroot -p

Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22-0ubuntu18.04.1 (Ubuntu)

Copyright (c) 2000, 2018, 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>

1.3 Configure MySQL remote login

# Modify the configuration file and comment out bind-address = 127.0.0.1
$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

# Save and exit, then enter the mysql service and execute the authorization command:
$ mysql -uroot -p

mysql> grant all on *.* to root@'%' identified by '123456' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
$ sudo /etc/init.d/mysql restart

Wonderful topic sharing:

MySQL different versions installation tutorial

MySQL 5.7 installation tutorials for various versions

MySQL 5.6 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:
  • Install MySQL in Ubuntu 18.04 (Graphical Tutorial)
  • Install MySQL 5.7 on Ubuntu 18.04
  • Ubuntu18.04 installation mysql8.0.11 graphic tutorial
  • How to install MySQL on Ubuntu 18.04 (linux)
  • Ubuntu 18.04 MySQL 8.0 installation and configuration method graphic tutorial
  • Solution to forgetting MySQL root password in Ubuntu
  • How to reset mysql server root password in ubuntu
  • Ubuntu 18.04 does not prompt for password when installing MySQL and how to solve it

<<:  VMware 15.5 version of the graphic tutorial to build a yum warehouse by mounting the system CD

>>:  Example of how to increase swap in CentOS7 system

Recommend

How to view the storage location of MySQL data files

We may have a question: After we install MySQL lo...

Implementing simple tabs with js

Tab selection cards are used very frequently on r...

vite2.x implements on-demand loading of ant-design-vue@next components

1. Use version vite:2.0 ant-design-vue: 2.0.0-rc....

A detailed explanation of the subtle differences between Readonly and Disabled

Readonly and Disabled both prevent users from chan...

HTML simple web form creation example introduction

<input> is used to collect user information ...

Problems encountered when uploading images using axios in Vue

Table of contents What is FormData? A practical e...

Detailed explanation of how to customize the style of CSS scroll bars

This article introduces the CSS scrollbar selecto...

The use and difference between JavaScript pseudo-array and array

Pseudo-arrays and arrays In JavaScript, except fo...

How to limit the input box to only input pure numbers in HTML

Limit input box to only pure numbers 1、onkeyup = ...

win10 mysql 5.6.35 winx64 free installation version configuration tutorial

mysql 5.6.35 winx64 free installation version con...

Q&A: Differences between XML and HTML

Q: I don’t know what is the difference between xml...