Get the App
SLTechnology News&Howtos  ›  Database  › 

Ubuntu 18.04 steps to configure mysql and configure a remote connection

Shulou Source: shulou.com Published: 2022-06-01 03:21:38 10月03日 Update

Preface

This article mainly shares with you about the configuration of mysql and remote connection of Ubuntu 18.04. share it for your reference and learning. let's take a look at the detailed introduction.

The configuration tutorial is as follows:

First of all, as we all know, there are three big tricks without saying anything:

Sudo apt-get install mysql-serversudo apt isntall mysql-clientsudo apt install libmysqlclient-dev

After these three steps, the mysql is installed, and then we secretly check it out.

Sudo netstat-tap | grep mysql

Well, in fact, this test is of no use.

Next, you may wonder, the database does not have a password. I've never seen you set a password.

Have no choice but to take a peek at the alternate password.

Sudo vim / etc/mysql/debian.cnf

Open this file with vim and see the following:

OK, yes, debian-sys-maint is the alternate user name, the following string is very high, the long one is the password

# then you can log in after entering your password using mysql-u debain-sys-maint-p #

Please change your password after logging in.

It is said that changing the password is actually adding a user, using middle-aged and elderly surfing the Internet, we add ourselves a user:

Mysql > grant all on *. * to admin@ "%" identified by "123"; # admin is your user name, 123 is the password, and give it full permissions

Then take out the basic syntax of mysql to see if it has been added successfully.

Mysql > select User,Host from mysql.user # to see if your user name has been added, and whether it is * permission

Then exit ();!

Restart it.

Sudo / etc/init.d/mysql restart

Remote connection? how to do it? this is simple. Pull out the administrator mode.

Sudo su # enter administrator sudo vim / etc/mysql/mysql.conf.d/mysqld.cnf # Open this file # precede the line 127.0.0.0 with a # number,: W save: Q exit

Restart again, solve the problem, you can log in with nevicat for nothing!

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Tags: Password user configuration content that is user name learning login next file permissions administrator reference backup check management success one line three middle-aged and elderly Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MariaDB Redmi Linux Shulou Tech Info