In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
One: prepare the environment:
Install the dependency package for MySQL and check that the installation is complete
Yum-y install ncurses-devel libaio-devel cmakerpm-qa ncurses-devel libaio-devel cmake
(2) create a user who starts MySQL
Useradd-s / sbin/nologin-M mysql
(3) standardize the installation path of the software package, and download the mysql-5.5.32 source code package.
Mkdir / home/oldboy/toolscd / home/oldboy/toolswget ftp://10.0.0.1/mysql-5.5.32.tar.gztar xf mysql-5.5.32.tar.gz cd mysql- 5.5.32 II: compile and install MySQL source code package
(1) use the cmake command to compile and install the source package of MySQL
Cmake-DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32\-DMYSQL_DATADIR=/application/mysql-5.5.32/data\-DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DEXTRA_CHARSETS=gbk,gb2312,utf8 Ascii\-DENABLED_LOOCAL_INFILE=ON\-DWITH_INNOBASE_STORAGE_ENGINE=1\-DWITH_FEDERATED_STORAGE_ENGINE=1\-DWITH_BLACKHOLE_STORAGE_ENGINE=1\-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\-DWITHOUT_PARRTITION_STORAGE_ENGINE=1\-DWITH_FAST_MUTEXES=1\-DWITH_ZLIB=bundled\-DENABLED_LOCAL_INFILE=1\-DWITH_READLINE=1\-DWITH_EMBEDDED_SERVER=1\-DWITH_DEBUG=0echo $?
(2) the steps to generate Makefile files are followed by installation.
Make & make installecho $?
(3) at this stage, our MySQL database will be installed.
Three: configure MySQL database
(1) create a soft link for the MySQL installation directory
Ln-s / application/mysql-5.5.32 / application/mysqlll / application/
(2) create a multi-instance directory of MySQL
Mkdir-p / data/ {3306 ~ 3307} / data
(3) download / data of multiple instances of MySQL
Cd / home/oldboy/tools/wget ftp://10.0.0.1/data.zipunzip data.zipcp-r data/ tree / data/
(4) set multi-instance MySQL startup script to allow execution
Find / data-type f-name "mysql" | xargs chmod + xfind / data-type f-name "mysql" | xargs ls-l
(5) Authorization management of the data directory of MySQL database
Chown-R mysql.mysql / data/ll / data/
(6) initialize the MySQL database
Cd / application/mysql/scripts/./mysql_install_db-- basedir=/application/mysql/-- datadir=/data/3306/data/-- user=mysql./mysql_install_db-- basedir=/application/mysql/-- datadir=/data/3307/data/-- user= MySQL IV: MySQL multi-instance configuration and startup
(1) start the first MySQL instance
/ data/3306/mysql start
(2) start the second MySQL instance
/ data/3307/mysql start
(3) start and complete the inspection
Netstat-lntup | grep 330
(4) copy the MySQL command to the specified sock directory
Cp / application/mysql/bin/* / usr/local/sbin/
(5) use the mysql command to log in to the database, and you need to specify sock when logging in.
Mysql-uroot-S / data/3306/mysql.sockmysql-uroot-S / data/3307/mysql.sock
(6) set the database of multiple instances of MySQL to start automatically.
Echo "# mysql multi instances" > > / etc/rc.localecho "/ data/3306/mysql start" > > / etc/rc.localecho "/ data/3307/mysql start" > > / etc/rc.localtail-n 3 / etc/rc.local
Troubleshooting common error problems:
(1) whether to resolve the host name
(2) whether the permission of tmp directory is 1777
(3) if multiple instances of MySQL are activated and the port is not found, wait for a while.
(4) troubleshoot the log at the end of the .err log.
Fifth: the method of adding multiple instances to MySQL
(1) create a directory for storing multiple instances
Mkdir / data/3308/data-p
(2) copy an instance to the specified directory
\ cp / data/3306/ {my.cnf,mysql} / data/3308/ll / data/3308
(3) be sure to back up the configuration file before modifying it.
\ cp / data/3308/ {my.cnf,my.cnf.source.bak}\ cp / data/3308/ {mysql,mysql.source.bak} ll / data/3308/
(4) use sed command to change the configuration file and startup script of MySQL in batch.
Sed-I's s/server-id 3306 / data/3308/ {my.cnf,mysql} sed-I 's/server-id = 1/server-id = 8gamma g' / data/3308/my.cnf
(5) set 3308 database instance owner to mysql user
Chown-R mysql.mysql / data/3308/ll / data/3308/
(6) set the permission of the startup script of the third database instance to 700
Chmod 700 / data/3308/mysqlll / data/3308/mysql
(7) initialize the database operation on the third database instance
Cd / application/mysql/scripts/./mysql_install_db-basedir=/application/mysql/-datadir=/data/3308/data/-user=mysql
(8) authorize the mysql startup script to execute.
Chmod + x / data/3308/mysql
(9) start the database of the third instance
/ data/3308/mysql start
(10) start and complete the inspection
Netstat-lntup | grep 330
(11) Test whether you can access the database
Mysql-S / data/3308/mysql.sock
(12) set the database to boot automatically.
Echo "/ data/3308/mysql start" > > / etc/rc.localtail-1 / etc/ rc.local6: because the password set in the script is oldboy, we will not be able to stop MySQLmysqladmin password oldboy-S / data/3306/mysql.sockmysqladmin password oldboy-S / data/3307/mysql.sockmysqladmin password oldboy-S / data/3308/mysql.sockmysql-uroot-poldboy123-S / data/3306/ mysql.sock7: MySQL remote connection test
(1) Command format
Mysql-uroot-poldboy-h 10.0.0.52-P Port number-P is the port parameter
(2) remote connection multi-instance database test
Mysql-uroot-poldboy-h 10.0.0.52-P 3306
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.