Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Install MySQL-5.5.49 process and configure multiple instances

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following content mainly brings you to install MySQL-5.5.49 process and configuration multiple examples, the knowledge mentioned, slightly different from books, are professional and technical personnel in contact with users, summed up, with a certain experience sharing value, hope to bring help to the majority of readers.

MySQL 5.5.49

Installation package acquisition: mirrors.sohu.com/mysql/

#Install dependencies required for MySQL yum install ncurses-devel libaio-devel -yrpm -qa ncurses-devel libaio-devel#Install software required for MySQL compilation yum install cmake -yrpm -qa cmake#Create user useradd mysql -u 777 -s /sbin/nologin -Mid mysql

Upload MySQL package, extract

mkdir -p /home/oldboy/toolscd /home/oldboy/toolsrz -y #mysql-5.5.49.tar.gzll -shtar xf mysql-5.5.49.tar.gz cd mysql-5.5.49

compile and install

cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.49 \-DMYSQL_DATADIR=/application/mysql-5.5.49/data \-DMYSQL_UNIX_ADDR=/application/mysql-5.5.49/tmp/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \-DENABLED_LOCAL_INFILE=ON \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_FEDERATED_STORAGE_ENGINE=1 \-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \-DWITH_FAST_MUTEXES=1 \-DWITH_ZLIB=bundled \-DENABLED_LOCAL_INFILE=1 \-DWITH_READLINE=1 \-DWITH_EMBEDDED_SERVER=1 \-DWITH_DEBUG=0make && make install && echo $? cd ..

Create soft links

ln -s /application/mysql-5.5.49/ /application/mysql

Configuring Multiple Instances

Create database file directories, profiles

mkdir -p /data/{3306,3307}/datatouch /data/{3306,3307}/{mysql,my.cnf}tree /data//data/├── 3306#/etc/profiletail -1 /etc/profilesource /etc/profileecho $PATH

Login and logout multiple instances

Login for multiple instances (no password)

mysql -S /data/3306/mysql.sockmysql -S /data/3307/mysql.sock

Logout (4 types)

mysql> exitmysql> quitmysql> Ctrl + cmysql> Ctrl + d

set a password

mysqladmin -uroot password 'oldboy123' -S /data/3306/mysql.sockmysqladmin -uroot password 'oldboy123' -S /data/3307/mysql.sock

Change password to: oldboy456

mysqladmin -uroot -poldboy123 password 'oldboy456' -S /data/3306/mysql.sock

Login with multiple instances (with password)

mysql -uroot -poldboy123 -S /data/3306/mysql.sockmysql -uroot -poldboy123 -S /data/3307/mysql.sock

Another example is 3308.

mkdir /data/3308/data -pcp /data/3306/{my.cnf,mysql} /data/3308/sed -i 's#3306#3308#g' /data/3308/{my.cnf,mysql}sed -i 's#server-id = 1#server-id = 8#g' /data/3308/my.cnfchown -R mysql.mysql /data/3308chmod 700 /data/3308/mysqlcd /application/mysql-5.5.49/scripts/./ mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/data/3308/data//data/3308/mysql startecho "/data/3308/mysql start" >>/etc/rc.localnetstat -tunpl |grep 330mysql -S /data/3308/mysql.sockmysqladmin -uroot password 'oldboy123' -S /data/3308/mysql.sockmysql -uroot -poldboy123 -S /data/3308/mysql.sock

MySQL Multi-instance Optimization

Clean up useless MySQL libraries (3306)

mysql -uroot -poldboy123 -S /data/3306/mysql.sockdrop database test;show databases;

Clean up useless MySQL users

select user,host from mysql.user;drop user "root"@"::1";drop user " "@"db02"; drop user "root"@"db02";drop user " "@"localhost";

Fault: drop command cannot delete user

May be caused by capitalization and Linux host name, note: delete users try to use the drop command, do not use the delete command

The solution is as follows:

delete from mysql.user where user='' and host='S1'; delete from mysql.user where user='root' and host='S1';

Refresh permissions

Refresh permissions to make changes take effect immediately

flush privileges;

For the above on the installation of MySQL-5.5.49 process and configuration of multiple examples, if you still need to know more can continue to pay attention to our industry push new, if you need to get professional answers, you can contact the official website pre-sales after-sales, I hope this article can bring you a certain knowledge update.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report