Home > Article > Daily Programming > What are the detailed steps to install mysql?
What are the detailed steps to install mysql?
The detailed steps to install mysql are:
MySQL download
Enter the official website of the page, find the download page and pull down the page , find the image below, and click DownloadWindows (x86, 64-bit), ZIP Archive
.
Then we will unzip the downloaded ZIP package
MySQL installation
1. Open the command line as an administrator and enter the decompression root directory/bin directory
2. Create the configuration file my.ini. There is no decompression file by default. We can create a new one and add it to the decompression root directory. (Create a new text document and change the suffix to .ini) Then we edit this file and set the MySQL root directory and the directory where the database data is stored.
When setting basedir and datadir, please note that if you use "\", please use double "\\" to split the directory. If you do not use this, you can use a single "/ ”
3. Initialize the MySQL data directory, that is, initialize the datadir we configured, execute the command administrator cmd> mysqld --initialize
and then a bunch of files will be generated in the data directory
4. Obtain the random password for the initialization database. After executing the previous step, the file generated in the data directory has an .err file, which contains the initialization password. We edit open this file and find the password. The file naming rule is [computer username.err] as shown below
Our initialization random password this time is: kdpsvo&9S4r>
5. Install the MySQL service , Administratorcmd> mysqld --install mysql8.0
6. Start the mysql service, Administratorcmd> net start mysql8. 0
Then wait for the message that the service has been successfully started, as shown below
7. Log in with the root account and random password to connect to the MySQL administratorcmd> mysql -u root -p
Then enter the random password above to log in successfully
8. Change the random password to rootmysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';Query OK, 0 rows affected(0.04sec);
Then exit, log in again with the new password, and you are done
Recommended tutorial: "mysql video tutorial"
The above is the detailed content of What are the detailed steps to install mysql?. For more information, please follow other related articles on the PHP Chinese website!