1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| [root@db01 ~]# mkdir /data/mysql/330{7,8,9} -p
[root@db01 ~]#vim /data/mysql/3307/my.cnf [mysqld] port=3307 basedir=/app/mysql datadir=/data/mysql/3307/data socket=/data/mysql/3307/data/mysql.sock pid_file=/data/mysql/3307/data/mysql.pid log_error=/data/mysql/3307/data/mysql.err
[root@db01 ~]# vim /data/mysql/3308/my.cnf [mysqld] port=3308 basedir=/app/mysql datadir=/data/mysql/3308/data socket=/data/mysql/3308/data/mysql.sock pid_file=/data/mysql/3308/data/mysql.pid log_error=/data/mysql/3308/data/mysql.err
[root@db01 ~]# vim /data/mysql/3309/my.cnf [mysqld] port=3309 basedir=/app/mysql datadir=/data/mysql/3309/data socket=/data/mysql/3309/data/mysql.sock pid_file=/data/mysql/3309/data/mysql.pid log_error=/data/mysql/3309/data/mysql.err
/app/mysql/scripts/mysql_install_db --user=mysql --basedir=/app/mysql --datadir=/data/mysql/3309/data
/app/mysql/scripts/mysql_install_db --user=mysql --basedir=/app/mysql --datadir=/data/mysql/3308/data
/app/mysql/scripts/mysql_install_db --user=mysql --basedir=/app/mysql --datadir=/data/mysql/3307/data
[root@db01 ~]# mysqld_safe --defaults-file=/data/mysql/3307/my.cnf
[root@db01 ~]# mysqld_safe --defaults-file=/data/mysql/3308/my.cnf
[root@db01 ~]# mysqld_safe --defaults-file=/data/mysql/3309/my.cnf
[root@db01 ~]# vim /usr/lib/systemd/system/mysql3307.service [Unit] Description=MySQL Server After=network.target Wants=multi-user.target
[Service] ExecStart=/app/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3307/my.cnf Restart=on-failure RestartSec=42s
[Install] WantedBy=multi-user.target
[root@db01 ~]# vim /usr/lib/systemd/system/mysql3308.service [Unit] Description=MySQL Server After=network.target Wants=multi-user.target
[Service] ExecStart=/app/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3308/my.cnf Restart=on-failure RestartSec=42s
[Install] WantedBy=multi-user.target
[root@db01 ~]# vim /usr/lib/systemd/system/mysql3309.service [Unit] Description=MySQL Server After=network.target Wants=multi-user.target
[Service] ExecStart=/app/mysql/bin/mysqld_safe --defaults-file=/data/mysql/3309/my.cnf Restart=on-failure RestartSec=42s
[Install] WantedBy=multi-user.target
[root@db01 ~]# systemctl daemon-reload
[root@db01 ~]# mysqladmin -uroot -S /data/mysql/3307/data/mysql.sock password '3307' [root@db01 ~]# mysqladmin -uroot -S /data/mysql/3307/data/mysql.sock password '3308' [root@db01 ~]# mysqladmin -uroot -S /data/mysql/3307/data/mysql.sock password '3309'
[root@db01 ~]# mysql -uroot -p3307 -S /data/mysql/3307/data/mysql.sock [root@db01 ~]# mysql -uroot -p3308 -S /data/mysql/3308/data/mysql.sock [root@db01 ~]# mysql -uroot -p3309 -S /data/mysql/3309/data/mysql.sock
[root@db01 ~]# vim /usr/local/bin/mysql3307 mysql -uroot -p3307 -S /data/mysql/3307/data/mysql.sock
[root@db01 ~]# vim /usr/local/bin/mysql3308 mysql -uroot -p3308 -S /data/mysql/3308/data/mysql.sock
[root@db01 ~]# vim /usr/local/bin/mysql3309 mysql -uroot -p3309 -S /data/mysql/3309/data/mysql.sock
[root@db01 ~]# chmod +x /usr/local/bin/mysql330*
mysql3307 mysql3308 mysql3309
|