安装解压缩的mysql_windows下安装解压缩mysql

解压之后可以将该文件夹改名,放到合适的位置,个人建议把文件夹改名为MySQL Server 5.6,放到C:\Program Files\MySQL路径中。当然你也可以放到自己想放的任意位置。

298a478bb94f54531e81391ca648154b.png

完成上述步骤之后,很多用户开始使用MySQL,但会出现图示的错误。这是因为没有配置环境变量所致。配置环境变量很简单:

我的电脑->属性->高级->环境变量

选择PATH,在其后面添加: 你的mysql bin文件夹的路径 (如:C:\Program Files\MySQL\MySQL Server 5.6\bin )

PATH=.......;C:\Program Files\MySQL\MySQL Server 5.6\bin (注意是追加,不是覆盖)

8ca32fc771f1462bdfd349232fe5182d.png

e3d40e1e4bac575969f772afff9cf2d1.png

配置完环境变量之后先别忙着启动mysql,我们还需要修改一下配置文件(如果没有配置,之后启动的时候就会出现图中的错误哦!:错误2 系统找不到文件),mysql-5.6.1X默认的配置文件是在C:\Program Files\MySQL\MySQL Server 5.6\my-default.ini,或者自己建立一个my.ini文件,

在其中修改或添加配置(如图):

[mysqld]

basedir=C:\Program Files\MySQL\MySQL Server 5.6(mysql所在目录)

datadir=C:\Program Files\MySQL\MySQL Server 5.6\data (mysql所在目录\data)

0f8d21bf4d9804022552f6f91efc5032.png

873d08602946d1dd02c87486770de98f.png

66ca9e1b96f842b6f6dc842772944a97.png

以管理员身份运行cmd(一定要用管理员身份运行,不然权限不够),

输入:cd C:\Program Files\MySQL\MySQL Server 5.6\bin 进入mysql的bin文件夹(不管有没有配置过环境变量,也要进入bin文件夹,否则之后启动服务仍然会报错误2)

输入mysqld -install(如果不用管理员身份运行,将会因为权限不够而出现错误:Install/Remove of the Service Denied!)

安装成功

f70a4ed403ee4731b7fdc19eba482132.png

4d1cf88e12143a03d29069fc837541c2.png

安装成功后就要启动服务了,继续在cmd中输入:net start mysql(如图),服务启动成功!

此时很多人会出现错误,请看注意:

注意:这个时候经常会出现错误2和错误1067。

如果出现“错误2 系统找不到文件”,检查一下是否修改过配置文件或者是否进入在bin目录下操作,如果配置文件修改正确并且进入了bin文件夹,需要先删除mysql(输入 mysqld -remove)再重新安装(输入 mysqld -install);

如果出现错误1067,那就是配置文件修改错误,确认一下配置文件是否正确。

57c8a441c4a581d108cc7448a7e780bf.png

服务启动成功之后,就可以登录了,如图,输入mysql -u root -p(第一次登录没有密码,直接按回车过),登录成功!

3cf9cdffdd25c6fcb035d8acd00bb807.png

Microsoft Windows XP [版本 5.1.2600]

(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>d:

D:\>cd d:/Mysql_win32\mysql-5.6.15\bin

D:\Mysql_win32\mysql-5.6.15\bin>mysqld -install

Service successfully installed.

D:\Mysql_win32\mysql-5.6.15\bin>net start mysql

MySQL 服务正在启动 .........

MySQL 服务已经启动成功。

D:\Mysql_win32\mysql-5.6.15\bin>mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.15-enterprise-commercial-advanced MySQL Enterprise Server -

Advanced Edition (Commercial)

Copyright (c) 2000, 2013, 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> set password for root@localhost = password('123456');

Query OK, 0 rows affected (0.09 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)

mysql> quit。

-> ;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

corresponds to your MySQL server version for the right syntax to use near 'quit

。' at line 1

mysql> quit

Bye

D:\Mysql_win32\mysql-5.6.15\bin>mysql -u root -p123456

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.6.15-enterprise-commercial-advanced MySQL Enterprise Server -

Advanced Edition (Commercial)

Copyright (c) 2000, 2013, 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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值