The front is the first configuration, may not solve the problem, can directly skip, directly look at the directory, the second reload record, more comprehensive


directory

  • For the first time with
    • The divider
  • Second reload, new problems encountered
    • Question 3: Your password has expired. To log in you must change it using a client that supports expir
    • Question 4: You must reset your password using ALTER USER statement before executing this statement.
    • Mysql 5.7.9 mysql 5.7.9 mysql 5.7.9 mysql 5.7.9 mysql 5.7.9
  • Linux installation 5.7.31
    • 1. Check whether wget and vim are installed
    • 2. Run the wget command to download mysql
    • 3. Check whether another version of mysql is installed on the local PC

For the first time with

Today I reinstalled mysql, and there are various problems with the configuration. Refer to the online article and record as follows: 1. Download mysql5.7.13- Windows version (1) mysql5.7.13- Win64 version W60l (2) mysql5.7.13 – win32 version baidu cloud share download link address: link: http://pan.baidu.com/s/1c2kcwFI password: qk3n

D:\mysql\mysql-5.7.13-winx64 D:\ mysql-5.7.13-winx64

3. Configure mysql environment variables

(1) Right-click my computer -> Properties -> Advanced System Settings (Advanced)-> Environment Variables click the New button under system variables to enter variable name: MYSQL_HOME enter variable value: D:\mysql\mysql-5.7.13-winx64

%MYSQL_HOME%\bin = MYSQL_HOME%\bin = MYSQL_HOME%\bin Separate, cannot delete the original variable value.

(3) Copy the default file my-default.ini from the decompressed directory, rename it my.ini, copy the following configuration information to my.ini and save it

[client] port=3306 default-character-set=utf8 [mysqld] port=3306 Character_set_server =utf8 basedir=D:\mysql\mysql-5.7.13-winx64 Sql_mode =NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [WinMySQLAdmin] D: / mysql/mysql - 5.7.13 - winx64 \ bin \ mysqld exeCopy the code

Check whether there is a data directory in the mysql directory.

If there is a data directory, ignore this point.

If not, open the CMD window as an administrator and go to the drive where mysql resides. For example: d:

Then CD to the mysql bin directory

(1) Use the mysqld –initialize-insecure command, which will generate a root user without a password. The mysqld –initialize command automatically generates a root user with a random password. It is recommended that you use the mysqld –initialize-insecure command to generate a root user without a password.

Mysqld –install mysqld –install mysqld

Net start mysql to start the mysql service

Mysql -u root -p enter mysql and press Enter again.

If you run mysqld –initialize-insecure in the first step, the mysql root password will be empty after the installation

Now you can change the password as follows:

Specific demonstration results:

Change the password

After the password is successfully changed, log in to the cli again

Net start mysql net stop mysql net stop mysql

MySQL > create shortcut for MySQL console

1) Desktop right-click -> New -> Shortcut -> object location input: C:\Windows\System32\cmd.exe shortcut name you define, confirm, shortcut established successfully

2) Right-click the shortcut -> Properties -> change the target column to MySQL startup parameters: C:\Windows\System32\cmd.exe “D:\MySQL\mysql-5.7.13-winx64\bin” /k MySQL -uroot -p -u User name -p Password Specifies the database name

3) Click OK to save the modification. Double-click the shortcut to connect to the MySQL database

7, the exit; Or quit; Exit the mysql; Restart the mysql; Mysql -uroot -p123456 mysql -uroot -p123456

If there are other problems, can refer to: www.cnblogs.com/liuzhen1995…


The divider


Second reload, new problems encountered

After installing mysql 8.0 on a new computer, I had to switch back to the lower version of mysql due to jar problems. This time, I installed mysql5.7.9. The installation process also took a lot of effort.

5.9.7 baidu cloud links: link: pan.baidu.com/s/1UvwDyzAU… Password: hj8x

Error 2: Access denied for user ‘root’ @ ‘localhost’ (using password: NO) error 3: Access denied for user ‘root’ @ ‘localhost’ (using password: NO)

Take a quick look at the process and post the full picture below:

1. Run CMD as administrator (open C:\Windows\System32, go to CMD, right click and choose Run as Administrator)

2. Go to the bin directory of the mysql file (E:\mysql-5.7.9-winx64).

3. Run mysqld-install

4. Run mysqld –initialize

After the initialization, the following files are generated in the data folder: If the preceding three folders do not exist, the initialization is not successful

At this point, the random password has been generated, so don’t worry about it

5.执行命令 net start mysql

If you are lucky, the service will start, then you will encounter problem 1, and then you can try to uninstall the service and start again. I shut down and restart, and I tried everything except reinstalling the system. Of course, the configuration problem is not to reinstall the system

6. Run SQL -uroot -p and press Enter, then you will be asked to enter the password, but you do not know the password, so you will be asked to enter the password

Solution to problem 2:

  1. Run net stop mysql to stop the mysql service

2. Run CMD as the administrator to go to the bin directory of mysql (the first two steps during the installation). If the previous commands are not closed, skip this step

Mysqld –skip-grant-tables: mysqld –skip-grant-tables: mysqld –skip-grant-tables: mysqld –skip-grant-tables: mysqld –skip-grant-tables: mysqld –skip-grant-tables: mysqld –skip-grant-tables

4. Open CMD and go to the bin directory of mysql

Mysql -uroot -p mysql -uroot -p mysql -uroot -p

At this point we are in mysql (the prompt becomes mysql>) so we change the password here

Changing the Root Password

1.mysql>use mysql;

2.mysql>slect * from user;

3. Execute if authenticATION_string is displayed

Mysql >update user set authentication_string=password(” root “) where user= “new password”;

Execute if password is displayed

Mysql >update user set password=password(” root “) where user= “new password”;

4.flush privileges;

Enter the new password the next time you log in

Here are the steps:

Question 1:





After the change is successful, use quit. Command to close the database, directly open the CMD window, test whether the password can connect to the database, you will find that you can enter the database, but the configuration is not complete, because Navicat to connect to the database will prompt the password expired, execute any command in the CMD window will prompt the problem 4……

Question 3: Your password has expired. To log in you must change it using a client that supports expir


Question 4: You must reset your password using ALTER USER statement before executing this statement.


After installing mysql, after logging in, whenever you run any command, you will always be prompted with this

Solutions:

SET PASSWORD = PASSWORD(‘ your new PASSWORD ‘);

ALTER USER ‘root’ @ ‘localhost’ PASSWORD EXPIRE NEVER;

step 3: flush privileges;

Complete the above three steps to log out again, use the new password on the line, above in addition to the red change to the new password, other original input can be, then try Navicat connection is normal……

So far is a successful configuration of mysql, very skin, toss me all afternoon……

Mysql 5.7.9 mysql 5.7.9 mysql 5.7.9 mysql 5.7.9 mysql 5.7.9

From start to finish configuration again:

  1. The first is to decompress, you need to manually create a data folder under the decompressed directory

  2. Ini = my.ini = my.ini = my.ini

    [client] port=3306 default-character-set=utf8 [mysqld] port=3306 Character_set_server =utf8 Datadir =D:\mysql\mysql-5.7.9-winx64\ datadir=D:\mysql\mysql-5.7.9-winx64\data Sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES [WinMySQLAdmin] D: / mysql/mysql - 5.7.9 - winx64 \ bin \ mysqld exeCopy the code
  3. Then, use the initialization command to initialize the data folder and manually create a new data folder under the decompressed directory. If the data folder is not created, the initialization will prompt the error that the data folder does not exist

  4. Mysqld-initialize -insecure –user = mysql mysqld-initialize -insecure –user = mysql mysqld-initialize -insecure

Here we use -initialize to generate a random password for our own tests, and -initialize-insecure to generate an empty password. -user=mysql; default user= root;

You can then see the initialization under the Data folder, which contains three folders and some files

  1. If not, go to the bin folder of mysql and install mysql. If not, go to the bin folder of mysql and install mysql. Net start mysql, net start mysql, net start mysql, net start mysql

  2. Mysql -uroot -p press Enter to enter mysql

  3. Because the password is empty at this time, so the last to change the login password, use

    mysql>use mysql
    mysql>alter user 'root'@'localhost' identified by 'new password';
    Copy the code

You can then log in using the new password

Linux installation 5.7.31

Mysql 5.7.31 mysql 5.7.31 mysql 5.7.31 mysql 5.7.31

Before the installation is local download, and then upload server, this time directly use wget download.

1. Check whether wget and vim are installed

yum -y install wget
Copy the code

If the command has been installed, a message is displayed indicating that it has been installed. Old versions are automatically updated to the latest version.

2. Run the wget command to download mysql

Download the file to the current folder.

[root@localhost local]# wget https:/ / dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.31-linux-glibc2.12-x86_64.tar.gz
Copy the code

3. Check whether another version of mysql is installed on the local PC

rpm -qa|grep -i  mysql
Copy the code

This command is used to check whether related components or services are installed on the local computer. You can list the names to be uninstalled to prepare for the next uninstallation.

Uninstall:

Yum -y remove the name found aboveCopy the code

When uninstalling mysql related components, you will be asked to enter y/n to confirm uninstallation.

As some versions come with Mariadb, check whether mariadb is available and uninstall it if necessary

rpm -qa|grep -i  mariadb
yum -y remove maria*
Copy the code

Specific installation steps reference: https://www.cnblogs.com/pingqlin341/p/13474713.html