In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to deploy the multi-instance installation of mysql database. The content of the article is carefully selected and edited by the author. It has a certain pertinence and is of great significance to everyone. Let's learn how to deploy the multi-instance installation of mysql database with the author.
There is already a running mysql database on the machine
Each database has its own configuration file, the same version, multiple instances or different versions can be 1.mkdir / data/mysql/ {3307author3308} / {etc,socket,pid,log,data,bin}-pv to create each instance directory 2.getent passwd mysql to check whether there are mysql users If not, create the mysql user useradd-s-r mysql3.chown-R mysql.mysql / data/mysql/ {3307 mysql3.chown 3308} 4.find /-name mysql_install* lookup initialization database script / usr/bin/mysql_install_db-- datadir=/data/mysql/3307/data-- user=mysql-- basedir=/usr Initialization data comments:-- datadir data directory-- basedir (default / usr) enter the database: show variables like'% base%'
5.tree / data/mysql/3307/ check whether the initial data is generated under the / data/mysql/3307/data directory 6.cp / etc/my.cnf / data/mysql/3307/etc/ vim / data/mysql/3307/etc/ my.cnf [mysqld] port=3307datadir=/data/mysql/3307/datasocket=/data/mysql/3307/socket/mysql.socksymbolic-links=0# enable slow log query slow_query_log=1long_query_time=1log_slow_admin_statements=1log_ Slow_slave_statements=1log-slow-queries=/var/lib/mysql/mysql3307- password. Log [mysqld _ safe] log-error=/data/mysql/3307/log/mysqld.logpid-file=/data/mysql/3307/pid/mysqld.pid7.chmod 700 / data/mysql/3307/bin/mysqld8.vim / data/mysql/3307/bin/mysqld #! / bin/shport=3307mysql_user= "root" mysql_pwd= "" # password Start cmd_path= "/ usr/bin" mysql_basedir= "/ data/mysql" mysql_sock= "$mysql_basedir/$port/socket/mysql.sock" function_start_mysql () {if [!-e "$mysql_sock"] then printf "Starting MySQL...\ n" $cmd_path/mysqld_safe-- defaults-file=$mysql_basedir/$port/etc/my.cnf & > / dev/null & else for the first time Printf "MySQL is running...\ n" exit fi} function_stop_mysql () {if [!-e "$mysql_sock"] then printf "MySQL is stopped...\ n" exit else # $cmd_path/mysqladmin-u $mysql_user-p$mysql_pwd-S $mysql_sock shutdown $cmd_path/mysqladmin-u $mysql_user-S $mysql_sock shutdown # you can use this fi} function_restart_mysql () {printf "Restarting MySQL...\ n" function_stop_mysql sleep 2 function_start_mysql} case $1 instart) function_start_mysql when you don't have a password ; stop) function_stop_mysql;;restart) function_restart_mysql;;*) printf "Usage: $mysql_basedir/$port/bin/mysqld {start | stop | restart}\ n" esac9.mysql-S / data/mysql/3307/socket/mysql.sock login mysql confirm whether the login is correct: show variables like'% port%'
10. Change the root password select user,host,password from mysql.user; update mysql.user set password=password ("root") where user= "root"; # remember to add the modified password to the my.cnf flush privileges
11.mysql-S / data/mysql/3307/socket/mysql.sock-uroot-proot
After reading the above about mysql database multi-instance installation how to deploy, many readers must have some understanding, if you need to get more industry knowledge and information, you can continue to follow our industry information column.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.