ubuntu mysql installation and connection to Navicat

  Today configure your own server, find a lot of online tutorials are a bit old and not very full. Simply write the whole process an Ubuntu install mysql, and Navicat connection with the

 

First, install mysql

  1. 

sudo apt-get install mysql-server

  Download mysql-server, encounter prompted to enter Y to continue.

  In this step, the old version will be prompted to set a password, there is no new version, the password change was in the following steps.

  2.

sudo apt install mysql-client

  3.

sudo apt install libmysqlclient-dev

  4.

mysql --version

  mysql version information appears to indicate mysql installation was successful.

 

Second, modify the mysql user name and password

  1.

sudo came /etc/mysql/debian.cnf

  debian.cnf file has automatically assigned to our account and password when installing mysql,

   

 

  The current version of the account of the account default is debian-sys-maint, random password.

  Mysql -uroot -p Enter your password, for example, I was

mysql -u debian-sys-maint -pTObY0dFrpidVrZ4Z

  This step and the wrong password is entered directly recommended in a statement, to avoid invisible password

  2. Modify the user name and password

mysql > use mysql;
mysql >update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';
mysql> update user set plugin="mysql_native_password"; 
mysql> flush privileges; //立即生效
mysql> quit;

  ps: remember mysql command line statement to the ";" at the end

  

Third, set up to allow remote access mysql service

  1.

sudo  vi /etc/mysql/mysql.conf.d/mysqld.cnf

  The bind-address = 127.0.0.1 commented

  2. Restart the mysql service

sudo service mysql restart

  Now you can try to connect mysql with the Navicat  

  3. If there is

  

mysql > use mysql;
mysql > select host from user where user='root';
mysql > update user set host = '%' where user ='root';
mysql > flush privileges; //立即生效
mysql > quit;

  The host is set to the wildcard%

  You can now properly connected.

Guess you like

Origin www.cnblogs.com/BlackFungus/p/12117197.html