download
First open the official website of mycat: MyCat2
There is a file download service in the download in the upper right corner, click it and find that it cannot be accessed
Here you need to configure the host and copy the following content to the host file. The host file location is in C:\Windows\System32\drivers\etc
210.51.26.184 mycat.org.cn www.mycat.org.cn dl.mycat.org.cn
After configuration, directly visit the following two addresses to download
http://dl.mycat.org.cn/2.0/install-template/mycat2-install-template-1.20.zip
http://dl.mycat.org.cn/2.0/1.20-release/mycat2-1.20-jar-with-dependencies-2021-12-23.jar
After downloading, these two things
Install
Unzip the zip package, then copy the jar package to the decompressed folder mycat\lib directory,
Upload the mycat folder to the linux server, I put it in the usr/local folder
Modify file permissions
After uploading, modify the permissions of the following four files in the mycat/bin directory to 777
After cd to the bin directory, execute the chmod command four times
chmod 777 mycat
chmod 777 wrapper-linux-x86-32
chmod 777 wrapper-linux-x86-64
chmod 777 wrapper-linux-ppc-64
configuration
Create a mycat user in the mysql to be used and grant permissions
Execute the following command in mysql
Create a user named mycat with a password of 123456
CREATE USER 'mycat'@'%' IDENTIFIED BY '123456';
Grant permission
GRANT XA_RECOVER_ADMIN ON *.* TO 'root'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'mycat'@'%';
to refresh
flush privileges;
Modify the prototype configuration of mycat
Go to the mycat/conf/datasource folder in the mycat folder
Edit the prototypeDs.datasource.json file inside
Change the username, password and connection parameters to the previously created mysql service parameters (create a test database in mysql in advance)
start mycat
Enter mycat/bin and execute the following command
start up
./mycat start
stop
./mycat stop
run in the foreground
./mycat console
reboot
./mycat restart
pause
./mycat pause
View startup status
./mycat status