- 论坛徽章:
- 9
|
本帖最后由 stupid_lee 于 2015-07-09 15:18 编辑
mysql是装的2个实例
[root@my55 ~]# head -20 /etc/my.cnf
[client]
port = 3306
socket = /data/mysql1/data/mysql.sock
user = root
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
user = root
#password = A123!@#b200
.............
启动mysql后
mysql -Pxxxx,xxxx为任何数字,都能连接上mysql,并且进入的是3306端口的实例于是修改mysql配置文件:
[root@my55 ~]# head -20 /etc/my.cnf
[client]
#port = 3306
#socket = /data/mysql1/data/mysql.sock
#user = root
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin
user = root
#password = A123!@#b200
.............
重启mysql后再次测试
[root@my55 ~]# mysql -P3306
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) #此时好像只能通过 -S path/to/mysql.sock 登录
[root@my55 ~]# mysql -S /data/mysql1/data/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.88-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
问题1、为什么在配置文件有client段的时候,mysql -P 会忽略-P后面的端口号直接进入了3306 ?
问题2、为什么注释掉clent段,不能通过制定端口(-P)登录,而必须制定socket文件?
|
|