菜单

安装多个mysql

2020年08月23日 - 我的心情
变异安装mysql:
https://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.30.tar.gz

shell> mkdir bld shell> cd bld
cmake .. -DMYSQL_TCP_PORT=3307 -DMYSQL_UNIX_ADDR=/var/run/mysqld/5.7/mysql.sock -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/5.7 -DMYSQL_DATADIR=/home/mysql5.7 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
shell> make shell> make install

bin/mysqld --defaults-file=/etc/mysql/5.7/my.cnf --initialize --user=mysql
=======start========= 
chown -R mysql:mysql /var/run/mysqld/5.7 
/usr/local/mysql/5.7/bin/mysqld_safe --defaults-file=/etc/mysql/5.7/my.cnf

/usr/local/mysql/5.7/bin/mysql -h127.0.0.1 -P 3307 -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root-password';
CREATE USER 'root'@'%' IDENTIFIED BY 'root-password';
grant all on *.* to 'root'@'%' with grant option;

 

-----------------
~# cat /etc/my.cnf
[mysqld]
user		= mysql
port		= 3307
basedir		= /usr/local/mysql/5.7
pid-file	= /var/run/mysqld/5.7/mysqld.pid
socket		= /var/run/mysqld/5.7/mysqld.sock
datadir		= /var/lib/mysql/5.7
log-error	= /var/log/mysql/error-5.7.log
# By default we only accept connections from localhost
#bind-address	= 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

query_cache_size=512M
query_cache_type=1
key_buffer_size=256M
innodb_buffer_pool_size=512M

language = /usr/local/mysql/5.7/share/english


sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION


 

配置开机启动项

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on

发表评论

电子邮件地址不会被公开。 必填项已用*标注