Ubuntu 18.04 installs mysql 5.7.23

Ubuntu 18.04 installs mysql 5.7.23

I installed MySQL smoothly in Ubuntu 16.04 before. This time, I encountered some problems when installing MySQL 5.7.23 in Ubuntu 18.04. It took me a long time to do so. Here is a record.

1. Install the database

sudo apt-get install mysql-server

By default, mysql-client and other related clients are installed when mysql-server is installed.

2. There will be problems if you log in directly at this time

This is a pitfall. After a lot of trouble, I found that it would be successful if I logged in with root permissions.

Well, since we can only log in with root user privileges, let's first look at the key information in mysql.user.

First check the user table structure:

mysql> show columns from user; 

There are mainly these items:

Host User authentication_string (here is the encrypted password) plugin

Check out these key data in the table:

As you can see, the root password is still empty, and plugin is obviously different from others. After checking relevant information, I found that this is the problem why ordinary users cannot log in.

3. Solve the problem and change the password

mysql> update user set authentication_string=PASSWORD("123456"), plugin="mysql_native_password" where user="root";
 
mysql> FLUSH PRIVILEGES;
 
# Exit and restart the MySQL service mysql> exit;
fknight@v310:~$ service mysql restart

After update:

Now you can log in to the MySQL database using the root account name with normal user privileges. Workbench/Navciat can then connect to the database and be used normally.

Summarize:

# Install MySQL and Workbranch
fknight@v310:~$ sudo apt-get install mysql-server mysql-client mysql-workbench
 
# Connect to the database with root privileges, the initial password is empty fknight@v310:~$ sudo mysql -u root -p
 
# Modify the plugin so that ordinary users can also log in as the root user of mysql, and modify the root password mysql> update user set authentication_string=PASSWORD("123456"), plugin="mysql_native_password" where user="root";
 
# Exit and restart the MySQL service mysql> exit;
fknight@v310:~$ service mysql restart

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 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)
  • 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 JavaScript object-oriented practice: encapsulation and dragging objects

>>:  Detailed explanation of the usage and difference between nohup and & in Linux

Recommend

Let's talk about the LIMIT statement in MySQL in detail

Table of contents question Server layer and stora...

The difference and execution method of select count() and select count(1)

Count(*) or Count(1) or Count([column]) are perha...

About input file control and beautification

When uploading on some websites, after clicking t...

How to set up Referer in Nginx to prevent image theft

If the server's images are hotlinked by other...

Detailed tutorial on how to install mysql8.0 using Linux yum command

1. Do a good job of cleaning before installation ...

Win10 + Ubuntu 16.04 dual system perfect installation tutorial [detailed]

Be sure to remember to back up your data, it is p...

Docker installs ClickHouse and initializes data testing

Clickhouse Introduction ClickHouse is a column-or...

Detailed explanation of how to access MySQL database remotely through Workbench

Preface Workbench is installed on one computer, a...

Apply provide and inject to refresh Vue page method

Table of contents Method 1: Call the function dir...

Web Design Help: Web Font Size Data Reference

<br />The content is reproduced from the Int...

Database query which object contains which field method statement

The database queries which object contains which ...

Let’s talk in detail about how JavaScript affects DOM tree construction

Table of contents Document Object Model (DOM) DOM...

React Router 5.1.0 uses useHistory to implement page jump navigation

Table of contents 1. Use the withRouter component...