Mariadb 开启多个实例
1.建立数据目录
/data/mysql/3307/
shown -R mysql:mysql 3307
2.配置文件
# # These groups are read by MariaDB server. # Use it for options that only the server (but not clients) should see # # See the examples of server my.cnf files in /usr/share/mysql/ # # this is read by the standalone daemon and embedded servers [server] # this is only for the mysqld standalone daemon [mysqld] user=mysql port=3307 datadir=/data/mysql/3307 socket=/data/mysql/3307/mysql.sock log_error=/data/logs/mariadb/3307_mariadb.log server-id=2 # # * Galera-related settings # [galera] # Mandatory settings #wsrep_on=ON #wsrep_provider= #wsrep_cluster_address= #binlog_format=row #default_storage_engine=InnoDB #innodb_autoinc_lock_mode=2 # # Allow server to accept connections on all interfaces. # #bind-address=0.0.0.0 # # Optional setting #wsrep_slave_threads=1 #innodb_flush_log_at_trx_commit=0 # this is only for embedded server [embedded] # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] character-set-server=utf8 # This group is only read by MariaDB-10.5 servers. # If you use the same .cnf file for MariaDB of different versions, # use this group for options that older servers don't understand [mariadb-10.5] # # These two groups are read by the client library # Use it for options that affect all clients, but not the server # [client] socket=/data/mysql/3306/mysql.sock # This group is not read by mysql client library, # If you use the same .cnf file for MySQL and MariaDB, # use it for MariaDB-only client options [client-mariadb] default-character-set=utf8
3.初始化数据库
/usr/bin/mysql_install_db --defaults-file=/data/mysql/3307/my.cnf --datadir=/data/mysql/3307
4. 启动
/usr/bin/mysqld_safe --defaults-file=/data/mysql/3307/my.cnf --skip-grant-tables 2>&1 > /dev/null &
5. 修改密码
mysql -uroot -p -S /data/mysql/3307/mysql.sock 空密码登陆
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'jetsong2326'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY 'jetsong2326'; flush privileges;
6. /usr/bin/mysqld_safe --defaults-file=/data/mysql/3307/my.cnf 2>&1 > /dev/null &
7.管理脚本
#!/bin/bash . /etc/init.d/functions PORT=$2 USER=root PASSWD=123456 MYSQLBIN='/usr/local/mysql/bin' SOCKETFILE="/multidata/${PORT}/mysql.sock" PIDFILE="/multidata/${PORT}/mysql.pid" MYCNF="/multidata/${PORT}/my.cnf" [[ $# -eq 2 ]] || { echo "Usage: $0 {start|stop|restart|reload} {PORT}" exit 1 } mysql_start() { [[ -e "$SOCKETFILE" ]] && { action "MySQL port: $PORT IS already running" /bin/false exit 0 } || { action "Starting MySQL... please wait" /bin/true $MYSQLBIN/mysqld_safe --defaults-file=$MYCNF &> /dev/null & } [[ "$?" == "0" ]] && { action "MySQL has been Started" /bin/true } || { action "MySQL Started" /bin/false } } mysql_stop() { [[ ! -e "$SOCKETFILE" ]] && { action "MySQL port:$PORT was already down" /bin/false } || { $MYSQLBIN/mysqladmin -u $USER -p$PASSWD -S $SOCKETFILE shutdown &>/dev/null } [[ "$?" == 0 ]] && { action "MySQL port:$PORT has been Stopped" /bin/true } } case "$1" in 'start') mysql_start ;; 'stop') mysql_stop ;; 'restart'|'reload') mysql_stop sleep 3 mysql_start ;; *) echo "Usage: $0 {start|stop|restart|reload} {PORT}" esac
怎么收藏这篇文章?
不错不错,我喜欢看 https://www.237fa.com/
兄弟写的非常好 https://www.cscnn.com/
《对决2016》动作片高清在线免费观看:https://www.jgz518.com/xingkong/94407.html
《圣诞保卫战》剧情片高清在线免费观看:https://www.jgz518.com/xingkong/151589.html
《对决2016》动作片高清在线免费观看:https://www.jgz518.com/xingkong/94407.html
《圣诞保卫战》剧情片高清在线免费观看:https://www.jgz518.com/xingkong/151589.html
《我的非常闺蜜(完整版)》国产剧高清在线免费观看:https://www.jgz518.com/xingkong/166591.html
《变身国王2:高刚外传》动画片高清在线免费观看:https://www.jgz518.com/xingkong/12283.html
《我的非常闺蜜(完整版)》国产剧高清在线免费观看:https://www.jgz518.com/xingkong/166591.html
《变身国王2:高刚外传》动画片高清在线免费观看:https://www.jgz518.com/xingkong/12283.html
《难以置信2018》剧情片高清在线免费观看:https://www.jgz518.com/xingkong/121763.html
《德云社郭德纲于谦相声专场上海站 2023》大陆综艺高清在线免费观看:https://www.jgz518.com/xingkong/28686.html
选材新颖独特,通过细节描写赋予主题鲜活生命力。
?学术类评语?
作者对主题的挖掘深入骨髓,展现了非凡的洞察力和理解力。
文字流畅如丝,语言优美动人,读来令人心旷神怡。
作者以简洁明了的语言,传达了深刻的思想和情感。