MySQL在Windows上安装多个实例的方法

网友投稿 678 2022-09-15

MySQL在Windows上安装多个实例的方法

MySQL在Windows上安装多个实例的方法

MySQL在Windows上安装多个实例的方法

Step 1: 解压MySQL安装包,配置my.ini文件,注意port不能设置为默认的3306,这里我们设置为3307端口:

basedir = E:\MySQL\mysql-5.7.17-win32 datadir = E:\MySQL\mysql-5.7.17-win32\data log_bin server_id=5717 port = 3307

Step 2: 打开CMD窗口,进入到安装路径的bin目录,这里为:E:\MySQL\mysql-5.7.17-win32\bin,执行如下命令:

mysqld --initialize-insecure mysqld install MySQL5711

Step 3:  执行成功后启动MySQL,并更新相应的密码,注意这里的初始密码为空

mysql -uroot -P3307 -p update mysql.user set authentication_string=password("lhr") where user="root"; update mysql.user set Host="%" where Host="127.0.0.1"; update mysql.user set Host="%" where Host="localhost"; flush privileges

Step 4:  验证登录:mysql -uroot -plhr -P3307

E:\MySQL\mysql-5.7.17-win32\bin>mysql -uroot -plhr -P3307 mysql: [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 5 Server version: 5.7.17-log 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. mysql> status -------------- mysql Ver 14.14 Distrib 5.7.17, for Win32 (AMD64) Connection id: 5 Current database: Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.7.17-log MySQL Community Server (GPL) Protocol version: 10 Connection: localhost via TCP/IP Server characterset: latin1 Db characterset: latin1 Client characterset: gbk Conn. characterset: gbk TCP port: 3307 Uptime: 4 min 40 sec Threads: 1 Questions: 14 Slow queries: 0 Opens: 116 Flush tables: 1 Open tables: 109 Queries per second avg: 0.050 -------------- mysql> select @@version; +------------+ | @@version | +------------+ | 5.7.17-log | +------------+ 1 row in set (0.00 sec) mysql> mysql> show variables like '%server_id%'; +----------------+-------+ | Variable_name | Value | +----------------+-------+ | server_id | 5717 | | server_id_bits | 32 | +----------------+-------+ 2 rows in set, 1 warning (0.02 sec) mysql> show variables like 'port'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 3307 | +---------------+-------+ 1 row in set, 1 warning (0.01 sec)

安装完毕。效果图:

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:C# 通过条件编译来控制不同版本(cctv5在线直播观看)
下一篇:Windows下 MySQL-5.7.11 安装与配置
相关文章

 发表评论

暂时没有评论,来抢沙发吧~