About ubuntu mysql5.7 ERROR 1045 solution and windows remote ubuntu settings and other issues

    Due to the version update, some previous methods of modifying the database password are no longer applicable.

    The solution for Ubuntu mysql5.7 ERROR 1045 is as follows:

    1. Modify the mysql configuration file so that it can log in without a password
        
         Command: sudo vim /etc/mysql/my.cnf
         After opening this file, add: skip under the file [mysql] -grant-tables
   
    2. Restart the service
     
         command: sudo service mysql restart

    3. Log in to mysql without a password

         -uroot -p
  
    4. Change the password

         First: use mysql;
         because the original (update user set password=password('123') where user ='root';) This command can no longer change the password. Using this name will report the following error:
         ERROR 1054 (42S22): Unknown column 'password' in 'field list'

        So I found the following command: update mysql.user set authentication_string=password('newpassword') where user='root';


        *Special attention is: the user table under the new version of mysql database has no Password field,

         but the encrypted user password is stored in the authentication_string field, so the above error is reported.
        
         flush privileges;
    
         exit;
        
         finally restore the configuration file, restart the mysql service (sudo service mysql restart), and log in again.



         The problem of Windows remote setting is as follows:
 
       
         1. First run sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

            after opening the file, find the line in the file: bind-address = 127.0.0.1, and then comment out this line.
         
            Then restart mysql, the command is as above.
      
          2. Only after authorized users can connect remotely


               mysql -uroot -ppassword After entering the database, run the following name:

          grant all privileges on *.* to root@"%" identified by "password" with grant option;


           flush privileges;


               The first line of the command is explained as follows, *.*: the first * represents the database name; the second * represents the table name. This means that all tables in all databases are authorized to the user. root: Grant the root account. "%": Indicates that the authorized user IP can be specified, which means that any IP address can access the MySQL database. "password": The password corresponding to the assigned account, where the password is replaced by your mysql root account password.

               The second line of command is to refresh the permission information.

         























Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326322160&siteId=291194637