win7 X64 bit installation mysql-5.7.21

https://blog.csdn.net/luozhuwang/article/details/79259568

 

1. Download the official online face mysql

Note: Be sure to download the corresponding version, first download is a bottom, and found that download errors, waited in vain for a long time.

2. Extract (where best not to put the system disk, because you know)

Be careful of situation Chinese characters; \ mysql-5.7.21 \ bin: 3. Add the environment variable to the path, this machine is D

 

4. Configure

Modify the my.ini file

my.ini file manually add your own

[mysql]  
  
#设置mysql客户端默认字符集  
  
default-character-set=utf8  
  
[mysqld]  
  
#设置3306端口  
  
port = 3306   
  
#设置mysql的安装目录  
  
basedir=D:\mysql-5.7.21
  
#设置mysql数据库的数据的存放目录  
  
datadir=D:\mysql-5.7.21\data  
  
#允许最大连接数  
  
max_connections=200  
  
#服务端使用的字符集默认为8比特编码的latin1字符集  
  
character-set-server=utf8  
  
#创建新表时将使用的默认存储引擎  
  
default-storage-engine=INNODB  

5. install mysql service and start it :( cmd must run with administrator privileges)

 

That is the origin of the data folder friends.
Open an administrator cmd window, change the directory to the bin directory where you extracted the file
and then enter the mysqld install Enter to run on the line
followed by enter net start mysql start the service
being given! ! !
"The server was unable to start, the server does not report any errors."
Then. . .
Re-enter in the insecure --user = --initialize mysqld MySQL
(After executing the above command, MySQL will be self-built a data folder, and built the default database, login user name is root, password is empty)
starts again: again enter net start mysql start the service, OK success.

6. Quit the Administrator window, open cmd window with ordinary, run cmd

7. After a successful start, enter show variables like 'character_set%'; look coding

 

Utf8 format are correct.

 

mysql to change the password is 123456:

 

 mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

 

如果出现以下问题,请按如下操作:

 

mysql -u root -p  两次回车;返回ERROR 1045(28000):Access denied for user 'root'@'localhost' (using password: NO) 用户root拒绝访问。

此时会提示密码错误

打开data目录,用记事本打开.err文件,搜索password会找到临时生成的密码,复制。

把密码复制过去,即可进入

但是进入之后用show databases;查看数据库的时候会出现ERROR 1820(HY000): You must reset your password using ALTER USER statement before executing this statement. (要重置密码才可以)

这时输入:ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; 返回:Query OK, 0 rows affected  密码重置成功,密码为:root

这句话除了要重置的密码其他的都不需要改,直接复制就可以

此时数据库就正常启动了,

转载文章:http://blog.csdn.net/you_are_my_dream/article/details/53022328

Guess you like

Origin blog.csdn.net/qq_20398345/article/details/91492411
Recommended