Ubuntu 18 Installing MySQL

1. The following three commands are sequentially installed beat

  a. sudo apt-get install -y mysql-server

  b. sudo apt-get install mysql-client

  c.  sudo apt-get install -y libmysqlclient-dev

2. The above installation process is basically the default installation, including user names and passwords, how to find the default user name and password to log in MySQL it

        Configuration file located in / etc / mysql

       

 

        Use gedit open debain.cnf, view the user name and password

        

 

        

        You can see the user name (user) password (password)

3. Based on the second step of the logon user name and password

        mysql -udebian-sys-maint -p3ZDl6sCpKesNnw5n (note -u and -p followed behind a user name and password, no spaces)

        Figure: Log success

        

 

4. Modify the user name and password

        Execute the following statement, using the mysql database, set the user name is root, password is 123456, the use of native encryption (after mysql 8.0 this is not the way the encryption), refresh, and then exits

   use mysql;
   update user  set  authentication_string = PASSWORD( "123456" ) where user = 'root' ;
   update user  set  plugin = "mysql_native_password" ;
   flush privileges;
   quit;
5. Verify that the amendment is successful
        Execution: mysql -u root -p
        Then prompted for a password: 123456
        login successful
        
6. supplement on top of mysql encryption
        Mysql8.0 previous versions of encryption rules are mysql_native_password, and after mysql8, encryption rules are caching_sha2_password,
        If you want to use some visual client connection encryption possible because the client and server can not be established due to inconsistent connection problems, solutions are:
        One is to upgrade the client drive, one is the mysql user password encryption rule can be reduced to mysql_native_password

 

 

        

 

Guess you like

Origin www.cnblogs.com/mosicol/p/11516688.html