Step Four: Install the initialization database
1. Run cmd as administrator (be sure to run as administrator, or not have enough permissions),
2, enter: D: [carriage return] (because in the D drive, to go to the D drive first)
3, input: cd D:\phpweb\mysql\bin [Enter] into the bin folder of MySQL (regardless of whether you have configured the environment variable, also to enter the Bin folder, or after the start of the service will still report error 2)
4. Input: mysqld--install [carriage return] (This command is to install the service, after the execution, prompt English success, this time you can see in your Windows Service MySQL service, but did not start.) )
5, input: mysqld--initialize--console This step is important , this is the initialization database , and then you can see in the final initialization of an [email protected]: There is a series of alphanumeric symbols behind it, which is the random password that MySQL automatically generates for you, be sure to write it down and use it when we log in to the MySQL database.
PS: use-initialize generate random password, use-initialize-insecure generate blank password, initialize Data folder will be generated automatically, do not create a new OH.
Step five: Start the MySQL service
Start the MySQL service before you can use the MySQL database. There are two ways to start MySQL:
Method One: Start the input with the command: net start MySQL [Enter]
Method Two: Start from the Windows service
Now we're ready to use MySQL.
Step six: Log in to MySQL database and modify the hard-to-remember random password automatically
Log in to MySQL database command
Input: mysql-uroot-p [Return]
Ask you to enter the password, the MySQL generated a random password input, and then enter, landed in, into the database we can change the password
The command to change the password is as follows:
SET PASSWORD = PASSWORD (' Your new password ');
PS: before mysql-5.6.*, update the root password directly with the UPDATE statement. In mysql-5.7.12, the System User table does not have password this column, this method is not used in mysql-5.7.12, we can only use SET password = password (' Your new password '); To change the password.
OK, the installation is over, the need for a graphical interface of friends themselves to find the right favorite.
====================================================================================================== "MySQL"-- A system error 2 solution occurredThe above operation, after completion, restart the MySQL ("Net Startmysql") service, or not, reported the same error.
Later, switch to the bin directory. Note here: When installing the MySQL service, be sure to switch to the bin directory of the MySQL installation directory. After switching to the bin directory, first remove the previously installed MySQL service, then reinstall the MySQL service and then start.