Home >Database >Mysql Tutorial >How to install and run mysql5.7
How to install and run mysql5.7: First, unzip the installation package to a directory and initialize the database; then set a random root password and start the mysqld service; then log in to Mysql and reset the root password; finally Install the windows service and set remote access permissions.
More related free learning recommendations: mysql tutorial(video)
mysql5.7 installation and running method:
1. Unzip to a directory, such as: D:\tools\mysql-5.7.11-winx64
2.mysql5 .7 version compressed package, there is no data folder by default, you need to initialize the database first, the command is as follows:
D:\tools\mysql-5.7.11-winx64\bin> mysqld --initialize
3. After initialization, it will be in the mysql-5.7.11-winx64
folder Generate a data folder. The root password of the mysql5.7 version is not empty by default, but a random password.
This password can be viewed in the "machine name.err" file under the data folder. The content is as follows :
2016-02-26T03:23:56.025673Z 1 [Note] A temporary password is generated for root@localhost: yai/UnHse8Nu
4. Start the mysqld service
D:\tools\mysql-5.7.11-winx64\bin> mysqld --console
5. Use the random password to log in to mysql. The command is as follows:
D:\tools\mysql-5.7.11-winx64\bin> mysql -uroot -pyai/UnHse8Nu
6. After logging in, you need to reset the root password. To use the database, the command is as follows:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
7. Install as a windows service
Installation: D:\tools\mysql-5.7.11-winx64\bin> mysqld --install
Uninstall: D:\tools\mysql-5.7.11-winx64\bin> mysqld --remove
8. Set remote access permissions
mysql> grant all PRIVILEGES on *.* to root@'%' identified by 'your_passwd'; mysql> flush privileges;
The above is the detailed content of How to install and run mysql5.7. For more information, please follow other related articles on the PHP Chinese website!