如何配置解压版MySQL

来源:互联网 发布:cc数据库 编辑:程序博客网 时间:2024/06/04 20:12

此处以mysql-5.7.14-winx64为例,本人亲自测试:

1.  添加D:\MySQL\mysql-5.7.14-winx64\bin目录到环境变量Path



2.  D:\MySQL\mysql-5.7.14-winx64目录下新建data文件夹


3. D:\MySQL\mysql-5.7.14-winx64目录下新建my.ini文件,路径根据实际情况填写,内容如下:


[mysqld]

basedir = D:\mysql-5.7.12-win32
datadir = D:\mysql-5.7.12-win32\data
port = 3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
character-set-server=utf8


4. 安装:

mysqld install (出现 Service successfully installed)


mysqld --initialize-insecure --user=mysql (输入完此指令回车后需要等待一会)


5. 启动:


net start mysql  (前面操作均无异常情况下,出现MySQL服务正在启动,等待一会出现MySQL服务已经启动成功)


6. 测试连接数据库, 刚安装没有密码,直接回车


mysql -u root -p
(出现:
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.14 MySQL Community Server (GPL)


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.



7. 修改root密码


set password for root@localhost = password('rootroot'); (' '里面为新密码)
(出现:Query OK, 0 rows affected, 1 warning (0.00 sec))


8. 允许远程连接


use mysql;
(出现:Database changed)
update user set host = '%' where user = 'root';
(出现:Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0)


select host, user from user;


GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;


FLUSH PRIVILEGES;

到这里,整个MySQL就配置完成了!

1 0
原创粉丝点击