您的位置:首页 > 数据库 > MySQL

Windows 10下mysql 64位 安装(mysql-5.7.11-winx64安装)

2016-04-04 21:33 459 查看

Windows下mysql 64位 安装(mysql-5.7.11-winx64安装)

系统Windows10

安装包mysql-5.7.11-winx64.zip

安装过程中遇到的问题,请留意4.0常见问题汇总,常见问题都可解决。

附上最近一次完成安装记录,给大忙人看的只有两张图和完整的命令。





完成的命令
C:\Windows\system32>g:
G:\>cd G:\database\mysql\bin
G:\database\mysql\bin>mysqld --initialize --user=mysql --console
G:\database\mysql\bin>mysqld  -install
G:\database\mysql\bin>net start mysql
G:\database\mysql\bin>mysql -u root -p
Enter password: ************
mysql> alter user root@localhost identified by "12345";
mysql> show variables like 'character%';


详细步骤-1.0 配置环境变量

Windows 进入环境变量,系统环境变量path中增加mysql解压缩路径如

E:\IDES\mysql-5.7.11-winx64\bin


2.0 配置my.ini文件(重命名mydefault.ini为my.ini)

设置utf-8字符集,在my.ini文件中找到如下内容修改为

[client] #增加的内容
#password = your_password
port  = 3306
socket  = /tmp/mysql.sock
default-character-set=utf8

[mysqld] #修改的内容
port  = 3306
socket  = /tmp/mysql.sock
character-set-server=utf8
character-set-filesystem = utf8


如图2.0



3.0 安装mysql

注意!不要自己手动创建data文件,要以管理员打开CMD,详情错误见文章尾部。

3.1 管理员身份打开CMD

3.2 初始化mysql(自动产生data文件,复制临时密码)

C:\WINDOWS\system32>mysqld --initialize --user=mysql --console


如图



3.3 安装服务和启动服务

C:\WINDOWS\system32>mysqld  -install
Service successfully installed.

C:\WINDOWS\system32>net start mysql
MySQL 服务正在启动 ..
MySQL 服务已经启动成功。


如图



3.4 进入mysql(用复制的临时密码进入mysql)

C:\WINDOWS\system32>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.7.11
Copyright (c) 2000, 2016, 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.


如图



3.5 修改密码(注意密码用”“双引号括起来)

mysql> alter user root@localhost identified by "12345";
Query OK, 0 rows affected (0.00 sec)


如图3.5



3.6 查看数据库默认字符集(此时已经修改为utf-8)

mysql> show variables like 'character%';




至此!Windows 10下mysql 64位 安装完成!

4.0 常见错误

4.1 错误Install/Remove of the Service Denied!

解决:以管理员身份运行CMD

4.2错误

C:\WINDOWS\system32>net start mysql

MySQL 服务正在启动 .

MySQL 服务无法启动。

服务没有报告任何错误。

请键入 NET HELPMSG 3534 以获得更多的帮助。

如图



解决:删除自建的mysql路径的下的data文件,然后重新初始化

4.3 错误发生系统错误 2。系统找不到指定的文件。

C:\Windows\system32>net start mysql

发生系统错误 2。

系统找不到指定的文件。

解决 首先删除服务
mysqld -remove
,然后cd 进入MySQL解压目录的bin目录下,再次执行
mysqld  -install
net start mysql
即可。

原因,默认生产的文件路径至c盘中,所以无法找到。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: