mycat无法登陆mysql时如何处理?

最近使用mycat登陆mysql时遇到了下面的问题

Can't connect to MySQL server on '10.42.99.160' (111)

1.针对上述情况,我们首先需要检查MyCat的配置文件schema.xml,是否存在错误

 

       

 

               

       

       

       

                writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">

                select user()

               

                        password="root">

               

       

~                 

2.查看mysql占用的端口

使用命令:ps –ef|grep mysqld

[root@10-42-99-160 mycat]# ps -ef|grep mysql

root      1451     1  0 09:21 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/libmysql/10-42-99-160.pid

mysql     1639  1451  0 09:21 pts/0    00:00:19 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/10-42-99-160.pid --socket=/var/lib/mysql/mysql.sock

root      2537  1351  0 17:28 pts/0    00:00:00 grep mysql

 

3.查看wrapper.log日志文件

[root@10-42-99-160 logs]# tail wrapper.log

STATUS | wrapper  | 2019/05/31 16:43:59 | --> Wrapper Started as Console

STATUS | wrapper  | 2019/05/31 16:43:59 | Launching a JVM...

INFO   | jvm 1    | 2019/05/31 16:43:59 | Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in

INFO   | jvm 1    | 2019/05/31 16:43:59 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

INFO   | jvm 1    | 2019/05/31 16:43:59 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

INFO   | jvm 1    | 2019/05/31 16:43:59 |

INFO   | jvm 1    | 2019/05/31 16:44:00 | log4j 2019-05-31 16:44:00 [./conf/log4j.xml] load completed.

INFO   | jvm 1    | 2019/05/31 16:44:00 | MyCAT Server startup successfully. see logs in logs/mycat.log

STATUS | wrapper  | 2019/05/31 16:45:08 | INT trapped.  Shutting down.

STATUS | wrapper  | 2019/05/31 16:45:09 | <-- Wrapper Stopped

查看mycat的日志文件,检测是否启动时出现问题

4.若是上述方法都没有错误,重启MyCat服务

[root@10-42-99-160 bin]# mycat restart

Stopping Mycat-server...

Mycat-server was not running.

Starting Mycat-server...

[root@10-42-99-160 bin]# mysql -uroot -proot -P8066 -h10.42.99.160

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 1

Server version: 5.5.8-mycat-1.5.1-RELEASE-20161130213509 MyCat Server (OpenCloundDB)

 

Copyright (c) 2009-2015 Percona LLC and/or its affiliates

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

 

 

你可能感兴趣的:(mycat)