前提安装java
参考https://www.php.cn/blog/detail/23325.html
然后接这一篇
https://www.php.cn/blog/detail/22094.html
[root@localhost my.cnf.d]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, 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> show databases
-> ;
+——————————+
| Database |
+——————————+
| information_schema |
| mysql |
| performance_schema |
| sys |
+——————————+
4 rows in set (0.00 sec)
mysql> create database test
-> ;
Query OK, 1 row affected (0.01 sec)
mysql> show databases;
+——————————+
| Database |
+——————————+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+——————————+
5 rows in set (0.01 sec)
mysql> exit
Bye
[root@localhost my.cnf.d]# ll -rt
total 0
[root@localhost my.cnf.d]# cd /opt
[root@localhost opt]# ll -rt
-rw-r—r—. 1 root root 17544969 Jun 12 09:02 Mycat-server-1.6.6.1-release-20181031195535-linux.tar.gz
-rw-r—r—. 1 root root 541091840 Jul 12 17:06 mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar
解压
tar -zxvf Mycat-server-1.6.6.1-release-20181031195535-linux.tar.gz
进入文本
vi /etc/profile
插入
export JAVA_HOME=/opt/jdk1.8.0_191
export JRE_HOME=/opt/jdk1.8.0_191/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
:wq
[root@localhost bin]# java -version
-bash: java: command not found
重启配置-不重启服务器的情况下,配置文件生效
[root@localhost bin]# source /etc/profile
[root@localhost bin]# java -version
java version “1.8.0_191”
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
进入/opt/mycat/conf,打开文本
[root@localhost conf]# vi server.xml
重点关注
在打开
[root@localhost conf]# vi schema.xml
删除这一部分,按esc,整行删除按dd删除光标一行
继续改配置
保存退出
[root@localhost bin]# ./mycat start
Starting Mycat-server…
[root@localhost bin]# pwd
/opt/mycat/bin
[root@localhost bin]# cd ../logs
[root@localhost logs]# ll -rt
total 8
-rw-r—r—. 1 root root 0 Jul 20 10:11 mycat.log
-rw-r—r—. 1 root root 5653 Jul 20 10:11 wrapper.log
[root@localhost logs]# tail -f wrapper.log
报错问题
打开mycat的conf目录修改schema.xml等xml配置文件,保证XML文件的第一个元素前面不能空格(也就是保证第一个元素是 <?xml version=”1.0” encoding=”UTF-8”?>开头,规范的XML格式),在重启
还是报错,待查??