一个服务器创建两个MySQL

转载:http://www.2cto.com/database/201412/357863.html

 

将已安装的数据库文件夹复制到另一个目录下



打开复制目录下的my.ini文件修改

[client]
  port=3307 #第一个数据库的默认端口是3306 这里需要另外启用一个端口
    # The TCP/IP Port the MySQL Server will listen on
[mysqld]
  port=3307
   # Path to installation directory. All paths are usually resolved relative to this.
  basedir="D:\secondmysql\MySQL Server 5.5\" #第二个数据库basedir
  # Path to the database root
  datadir="D:\secondmysql\MySQL Server 5.5\data\" #第二个数据库datadir





管理员身份运行cmd创建启动服务
这里需要先cd到bin文件夹
mysqld install MySQL2 --defaults-file="D:\secondmysql\MySQL Server 5.5\my.ini"

若成功返回:serivce successfully install



此时在启动  net start MySQL2 

此时root下是无密码的,可直接 mysql -u -p



source:http://www.2cto.com/database/201412/357863.html

PS:

1  如果没有找到bin文件夹。

那么先去服务中,找到mysql,然后查看可执行路劲。

2  如果本地连得上,远程连不上。

那么可能端口没有开启!

 

 

posted @ 2018-07-27 14:28  正怒月神  阅读(432)  评论(0编辑  收藏  举报