The use of MYSQL5.6 free installation version under windows

1. Go to the MYSQL official website to download the MYSQL free installation version. Since my system is 64-bit, I downloaded the 64-bit version of Mysql

 http://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.34-winx64.zip

2. Put the downloaded mysql-5.6.34-winx64.zip on the D drive, decompress it, and then rename it to mysql

 

3. Set environment variables, select "Computer" with the mouse >> then right-click, select Properties >> "Advanced System Settings" >> "Environment Variables"

Create a new environment variable MYSQL_HOME whose value is D:\mysql

Also add the Mysql bin directory on the PATH path, that is, D:\mysql\bin

Fourth, modify the D:\mysql\my-default.init configuration file, here mainly modify two of the path variables, the settings of other parameters are set according to their actual situation, here is a simple configuration

The modified content is as follows:

basedir =D:\mysql
datadir =D:\mysql\data

Note: These two variables must be consistent with the location of your mysql

Five, install mysql service

In the dos interface, go to the D:\mysql\bin directory

Execute mysqld -install to install the service

Note: When installing the service, you must enter the D:\mysql\bin directory. Otherwise, there will be no problems and the service cannot be started.

If you need to cancel the service, you can execute mysqld -remove, but the service must be canceled when the mysql service is closed

6. Start the service

net start mysql (start service)

And if you need to stop the service, execute the command net stop mysql

Seven, log in to mysql, and then change the password

It should be noted here that if you directly execute mysql without user parameters, you will find that there is no mysql database when you show databases (this is a bit different from the linux version, and linux directly input mysql will also have a mysql database), and change the password Is to modify the user table under the mysql database.

(1) So the command to log in for the first time is:

mysql  -uroot

(2) Then change the password:

 Execute the command use mysql; this shows that the following will operate on the mysql database

Execute the command update user set password=PASSWORD('123456') where user ='root';

Remember to refresh the permissions after modifying the command, otherwise the modification will not work after exiting, because the modified data has not been persisted to the hard disk at this time, but only resides in memory

Execute the command flush privileges; 

 

8. Modify access rights

The previous steps can only log in to the mysql server locally. If you want to develop externally, you need to do some permission settings, such as the following permission settings

Execute the command grant all privileges on *.* to '%'@'%' identified by '123456'

in:

*.* The first * represents the database, the second * represents the table, here is to open all databases and tables, you can also set specific libraries and tables

'%'@'%' The first % represents the username, which represents all users, and the second '%' represents the host name or ip address, which also represents all hosts

'123456' means the login password

Still have to remember, after modifying the permission settings, remember to refresh

flush privileges;

 

mysql5.7 version:

The administrator runs cmd, enters: mysqld -install, it shows that the installation is successful; then enter: net start mysql, it prompts that the service failed to start,

At this point: Go to the data folder and see 5 files, open the file with the suffix .err, and it prompts: Table 'mysql.plugin' doesn't exist

The solution to this problem is:

1. Copy my.ini to the \bin folder;

2. Go to the \bin directory in cmd, and then enter mysqld --initialize --user=mysql --console to execute this command to generate the library. Note that there is a temporary password, which should be written down;

3. Start the service net start mysql;

4. Enter the mysql command: mysql -uroot -p, enter the password just now;

5. Enter set password = password('root') again to modify the root login password;

Guess you like

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