window 安装mysql

常见错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 密码输入错误;无法远程连接,授权root用户 flush privileges;

1、下载zip:https://dev.mysql.com/downloads/file/?id=474263

2、安装、启动、修改密码、支持远程连接

C:\Users\Administrator>cd C:\Users\Administrator\Downloads\mysql-5.6.39-winx64\m
ysql-5.6.39-winx64\bin

C:\Users\Administrator\Downloads\mysql-5.6.39-winx64\mysql-5.6.39-winx64\bin>mys
qld install
Service successfully installed.

C:\Users\Administrator\Downloads\mysql-5.6.39-winx64\mysql-5.6.39-winx64\bin>net
start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。


C:\Users\Administrator\Downloads\mysql-5.6.39-winx64\mysql-5.6.39-winx64\bin>mys
ql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

 

C:\Users\Administrator>mysql -u root -p
Enter password: **********
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

C:\Users\Administrator>mysql -u root -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.39 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Database changed
mysql> show tables;

mysql> update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
mysql> select * from user where user='root';

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

将相应用户数据表中的host字段改成'%';

 

update user set host='%' where user='root';

ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 不予理会

 

flush privileges;

重新远程连接OK

posted on 2018-04-01 18:29  王德冲  阅读(169)  评论(0)    收藏  举报

导航