您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql多实例如何部署

2025/11/6 20:23:48发布10次查看
mysql多实例部署软件下载[root@lnh ~]# rpm -qa |grep mysql[root@lnh ~]# ss -antlstate recv-q send-q local address:port peer address:port process listen 0 128 0.0.0.0:22 0.0.0.0:* listen 0 128 [::]:22 [::]:* //验证一下是否有mysql[root@lnh ~]# cd /usr/src/[root@lnh src]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz--2022-07-31 14:25:22-- https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gzresolving downloads.mysql.com (downloads.mysql.com)... 23.10.6.175, 2600:1405:1800:19c::2e31, 2600:1405:1800:184::2e31connecting to downloads.mysql.com (downloads.mysql.com)|23.10.6.175|:443... connected.http request sent, awaiting response... 302 moved temporarilylocation: https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz [following]--2022-07-31 14:25:23-- https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gzresolving cdn.mysql.com (cdn.mysql.com)... 23.212.157.5connecting to cdn.mysql.com (cdn.mysql.com)|23.212.157.5|:443... connected.http request sent, awaiting response... 200 oklength: 674830866 (644m) [application/x-tar-gz]saving to: ‘mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz'mysql-5.7.38-linux-g 100%[=====================>] 643.57m 1.88mb/s in 8m 54s 2022-07-31 14:34:17 (1.21 mb/s) - ‘mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz' saved [674830866/674830866]//在www.mysql.com里面进行复制下载地址[root@lnh src]# lsdebug kernels mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
配置用户并解压二进制程序至/usr/local下[root@lnh src]# useradd -r -m -s /sbin/nologin mysql[root@lnh src]# id mysqluid=993(mysql) gid=990(mysql) groups=990(mysql)[root@lnh src]# tar -xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -c /usr/local/[root@lnh src]# cd /usr/local/[root@lnh local]# ll //查看解压的东西total 0drwxr-xr-x. 14 root root 164 jul 21 21:32 apachedrwxr-xr-x. 6 root root 58 jul 21 21:12 aprdrwxr-xr-x. 5 root root 43 jul 21 21:17 apr-utildrwxr-xr-x. 2 root root 6 may 19 2020 bindrwxr-xr-x. 2 root root 6 may 19 2020 etcdrwxr-xr-x. 2 root root 6 may 19 2020 gamesdrwxr-xr-x. 2 root root 6 may 19 2020 includedrwxr-xr-x. 2 root root 6 may 19 2020 libdrwxr-xr-x. 3 root root 17 jul 19 16:13 lib64drwxr-xr-x. 2 root root 6 may 19 2020 libexecdrwxr-xr-x. 9 root root 129 jul 31 14:56 mysql-5.7.38-linux-glibc2.12-x86_64drwxr-xr-x. 2 root root 6 may 19 2020 sbindrwxr-xr-x. 5 root root 49 jul 19 16:13 sharedrwxr-xr-x. 5 root root 145 jul 21 21:19 src[root@lnh local]# ln -sv mysql-5.7.38-linux-glibc2.12-x86_64 mysql //做一个软链接 //-v是将结果打印出来 'mysql' -> 'mysql-5.7.38-linux-glibc2.12-x86_64'[root@lnh local]# ll //查看total 0drwxr-xr-x. 14 root root 164 jul 21 21:32 apachedrwxr-xr-x. 6 root root 58 jul 21 21:12 aprdrwxr-xr-x. 5 root root 43 jul 21 21:17 apr-utildrwxr-xr-x. 2 root root 6 may 19 2020 bindrwxr-xr-x. 2 root root 6 may 19 2020 etcdrwxr-xr-x. 2 root root 6 may 19 2020 gamesdrwxr-xr-x. 2 root root 6 may 19 2020 includedrwxr-xr-x. 2 root root 6 may 19 2020 libdrwxr-xr-x. 3 root root 17 jul 19 16:13 lib64drwxr-xr-x. 2 root root 6 may 19 2020 libexeclrwxrwxrwx. 1 root root 35 jul 31 14:58 mysql -> mysql-5.7.38-linux-glibc2.12-x86_64drwxr-xr-x. 9 root root 129 jul 31 14:56 mysql-5.7.38-linux-glibc2.12-x86_64drwxr-xr-x. 2 root root 6 may 19 2020 sbindrwxr-xr-x. 5 root root 49 jul 19 16:13 sharedrwxr-xr-x. 5 root root 145 jul 21 21:19 src[root@lnh local]# chown -r mysql.mysql mysql* //将软链接的属主属组改成mysql的[root@lnh local]# lltotal 0drwxr-xr-x. 14 root root 164 jul 21 21:32 apachedrwxr-xr-x. 6 root root 58 jul 21 21:12 aprdrwxr-xr-x. 5 root root 43 jul 21 21:17 apr-utildrwxr-xr-x. 2 root root 6 may 19 2020 bindrwxr-xr-x. 2 root root 6 may 19 2020 etcdrwxr-xr-x. 2 root root 6 may 19 2020 gamesdrwxr-xr-x. 2 root root 6 may 19 2020 includedrwxr-xr-x. 2 root root 6 may 19 2020 libdrwxr-xr-x. 3 root root 17 jul 19 16:13 lib64drwxr-xr-x. 2 root root 6 may 19 2020 libexeclrwxrwxrwx. 1 mysql mysql 35 jul 31 14:58 mysql -> mysql-5.7.38-linux-glibc2.12-x86_64drwxr-xr-x. 9 mysql mysql 129 jul 31 14:56 mysql-5.7.38-linux-glibc2.12-x86_64drwxr-xr-x. 2 root root 6 may 19 2020 sbindrwxr-xr-x. 5 root root 49 jul 19 16:13 sharedrwxr-xr-x. 5 root root 145 jul 21 21:19 src[root@lnh local]# ls //编译三部曲已经完成apache bin include libexec sbinapr etc lib mysql shareapr-util games lib64 mysql-5.7.38-linux-glibc2.12-x86_64 src[root@lnh local]# cd mysql[root@lnh mysql]# lsbin docs include lib license man readme share support-files[root@lnh mysql]# echo 'export path=$path:/usr/local/mysql/bin' > /etc/profile.d/mysql.sh //配置环境变量[root@lnh mysql]# source /etc/profile.d/mysql.sh //使环境生效[root@lnh mysql]# ln -sv /usr/local/mysql/include/ /usr/include/mysql'/usr/include/mysql' -> '/usr/local/mysql/include/'//做include的头文件让系统可以识别[root@lnh mysql]# chown -r mysql.mysql /usr/include/mysql//将软链接的属主属组改成mysql的[root@lnh mysql]# ll -d /usr/include/mysql/drwxr-xr-x. 3 mysql mysql 4096 jul 31 14:56 /usr/include/mysql/[root@lnh mysql]# vim /etc/ld.so.conf.d/mysql.conf[root@lnh mysql]# cat /etc/ld.so.conf.d/mysql.conf/usr/local/mysql/lib//配置lib[root@lnh mysql]# ldconfig //刷新配置[root@lnh mysql]# vim /etc/man_db.conf #mandatory_manpath /usr/src/pvm3/man#mandatory_manpath /usr/manmandatory_manpath /usr/share/manmandatory_manpath /usr/local/share/manmandatory_manpath /usr/local/mysql/man//添加这一行
创建各实例数据存放的目录[root@lnh ~]# mkdir -p /opt/data/{3306,3307,3308} //创建存放目录[root@lnh ~]# chown -r mysql.mysql /opt/data/ [root@lnh ~]# ll -d /opt/data/drwxr-xr-x. 5 mysql mysql 42 jul 31 15:24 /opt/data///修改其所属主所属组[root@lnh ~]# tree /opt/data//opt/data/├── 3306├── 3307└── 33083 directories, 0 files//查看其结构
初始化各实例[root@lnh ~]# mysqld --initialize --user mysql --datadir /opt/data/3306 //初始化实例 --user指定用户 --datadir指定数据目录2022-07-31t07:29:37.154689z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).2022-07-31t07:29:37.346729z 0 [warning] innodb: new log files created, lsn=457902022-07-31t07:29:37.389866z 0 [warning] innodb: creating foreign key constraint system tables.2022-07-31t07:29:37.450981z 0 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: 88389665-10a2-11ed-9840-000c2905f428.2022-07-31t07:29:37.452192z 0 [warning] gtid table is not ready to be used. table 'mysql.gtid_executed' cannot be opened.2022-07-31t07:29:37.758320z 0 [warning] a deprecated tls version tlsv1 is enabled. please use tlsv1.2 or higher.2022-07-31t07:29:37.758378z 0 [warning] a deprecated tls version tlsv1.1 is enabled. please use tlsv1.2 or higher.2022-07-31t07:29:37.759177z 0 [warning] ca certificate ca.pem is self signed.2022-07-31t07:29:37.780720z 1 [note] a temporary password is generated for root@localhost: aqlde*a:o8fr[root@lnh ~]# echo 'aqlde*a:o8fr' > 3306[root@lnh ~]# cat 3306 aqlde*a:o8fr//将这个格式化的随机密码生成到一个文件里面[root@lnh ~]# mysqld --initialize --user mysql --datadir /opt/data/3307 //格式化33072022-07-31t07:33:29.214978z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).2022-07-31t07:33:29.491805z 0 [warning] innodb: new log files created, lsn=457902022-07-31t07:33:29.524728z 0 [warning] innodb: creating foreign key constraint system tables.2022-07-31t07:33:29.598226z 0 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: 12977170-10a3-11ed-9d3d-000c2905f428.2022-07-31t07:33:29.599323z 0 [warning] gtid table is not ready to be used. table 'mysql.gtid_executed' cannot be opened.2022-07-31t07:33:29.932320z 0 [warning] a deprecated tls version tlsv1 is enabled. please use tlsv1.2 or higher.2022-07-31t07:33:29.932367z 0 [warning] a deprecated tls version tlsv1.1 is enabled. please use tlsv1.2 or higher.2022-07-31t07:33:29.932766z 0 [warning] ca certificate ca.pem is self signed.2022-07-31t07:33:30.095306z 1 [note] a temporary password is generated for root@localhost: pajbo+gxg19i[root@lnh ~]# echo ' pajbo+gxg19i' > 3307[root@lnh ~]# cat 3307 pajbo+gxg19i[root@lnh ~]# mysqld --initialize --user mysql --datadir /opt/data/3308 //格式化33082022-07-31t07:34:23.861697z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).2022-07-31t07:34:24.082852z 0 [warning] innodb: new log files created, lsn=457902022-07-31t07:34:24.112764z 0 [warning] innodb: creating foreign key constraint system tables.2022-07-31t07:34:24.173299z 0 [warning] no existing uuid has been found, so we assume that this is the first time that this server has been started. generating a new uuid: 331ef070-10a3-11ed-a122-000c2905f428.2022-07-31t07:34:24.175009z 0 [warning] gtid table is not ready to be used. table 'mysql.gtid_executed' cannot be opened.2022-07-31t07:34:24.374707z 0 [warning] a deprecated tls version tlsv1 is enabled. please use tlsv1.2 or higher.2022-07-31t07:34:24.374737z 0 [warning] a deprecated tls version tlsv1.1 is enabled. please use tlsv1.2 or higher.2022-07-31t07:34:24.375103z 0 [warning] ca certificate ca.pem is self signed.2022-07-31t07:34:24.471521z 1 [note] a temporary password is generated for root@localhost: =w&lnu)d-7kk[root@lnh ~]# echo ' =w&lnu)d-7kk' > 3308[root@lnh ~]# cat 3308 =w&lnu)d-7kk[root@lnh ~]# ls3306 3307 3308 anaconda-ks.cfg
安装perl[root@lnh ~]# dnf -y install perllast metadata expiration check: 1:24:50 ago on sun 31 jul 2022 02:13:54 pm cst.dependencies resolved.=================================================================================== package arch version repo size===================================================================================installing: perl x86_64 4:5.26.3-420.el8 appstream 73 kinstalling dependencies: perl-algorithm-diff noarch 1.1903-9.el8 base 52 k perl-archive-tar noarch 2.30-1.el8 base 79 k perl-archive-zip noarch 1.60-3.el8 appstream 108 k perl-attribute-handlers noarch 0.99-420.el8 appstream 89 k perl-b-debug noarch 1.26-2.el8 appstream 26 k perl-cpan noarch 2.18-397.el8 appstream 554 k perl-cpan-meta noarch 2.150010-396.el8 appstream 191 k perl-cpan-meta-requirements noarch 2.140-396.el8 appstream 37 k perl-cpan-meta-yaml noarch 0.018-397.el8 appstream 34 k perl-compress-bzip2 x86_64 2.26-6.el8 appstream 72 k perl-compress-raw-bzip2 x86_64 2.081-1.el8 base 40 k perl-compress-raw-zlib x86_64 2.081-1.el8 base 68 k perl-config-perl-v noarch 0.30-1.el8 appstream 22 k perl-db_file x86_64 1.842-1.el8 appstream 83 k perl-data-optlist noarch 0.110-6.el8 appstream 31 k perl-data-section noarch 0.200007-3.el8 appstream 30 k perl-devel-ppport x86_64 3.36-5.el8 appstream 118 k perl-devel-peek x86_64 1.26-420.el8 appstream 94 k perl-devel-selfstubber noarch 1.06-420.el8 appstream 76 k perl-devel-size x86_64 0.81-2.el8 appstream 34 k perl-digest-sha x86_64 1:6.02-1.el8 appstream 66 k perl-encode-devel x86_64 4:2.97-3.el8 appstream 39 k perl-env noarch 1.04-395.el8 appstream 21 k perl-extutils-cbuilder noarch 1:0.280230-2.el8 appstream 48 k perl-extutils-command noarch 1:7.34-1.el8 appstream 19 k perl-extutils-embed noarch 1.34-420.el8 appstream 79 k....
配置配置文件/etc/my.cnf[root@lnh ~]# vim /etc/my.cnf[root@lnh ~]# cat /etc/my.cnf[mysqld_multi] //程序命令mysqld = /usr/local/mysql/bin/mysqld_safe //命令执行的路径mysqladmin = /usr/local/mysql/bin/mysqladmin //命令执行的路径[mysqld3306] datadir = /opt/data/3306 //数据目录port = 3306 //端口socket = /tmp/mysql3306.sock //套接字pid-file = /opt/data/3306/mysql_3306.pid //pid进程文件log-error=/var/log/3306.log //错误日志[mysqld3307]datadir = /opt/data/3307port = 3307socket = /tmp/mysql3307.sockpid-file = /opt/data/3307/mysql_3307.pidlog-error=/var/log/3307.log[mysqld3308]datadir = /opt/data/3308port = 3308socket = /tmp/mysql3308.sockpid-file = /opt/data/3308/mysql_3308.pidlog-error=/var/log/3308.log
启动各实例[root@lnh ~]# mysqld_multi start 3306[root@lnh ~]# mysqld_multi start 3307[root@lnh ~]# mysqld_multi start 3308[root@lnh ~]# ss -antl state recv-q send-q local address:port peer address:port process listen 0 128 0.0.0.0:22 0.0.0.0:* listen 0 128 [::]:22 [::]:* listen 0 80 *:3306 *:* listen 0 80 *:3307 *:* listen 0 80 *:3308 *:* //这种方式启动不建议[root@lnh ~]# mysqld_multi stop 3308[root@lnh ~]# ss -antl state recv-q send-q local address:port peer address:port process listen 0 128 0.0.0.0:22 0.0.0.0:* listen 0 128 [::]:22 [::]:* listen 0 80 *:3306 *:* listen 0 80 *:3307 *:* listen 0 80 *:3308 *:* //可以发现这种方式启动程序后关闭不了[root@lnh ~]# ps -ef |grep 3306root 71742 1 0 15:49 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data/3306 --port=3306 --socket=/tmp/mysql3306.sock --pid-file=/opt/data/3306/mysql_3306.pid --log-error=/var/log/3306.logmysql 71878 71742 0 15:49 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/data/3306 --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/3306.log --pid-file=/opt/data/3306/mysql_3306.pid --socket=/tmp/mysql3306.sock --port=3306root 72257 66880 0 15:53 pts/1 00:00:00 grep --color=auto 3306//查看3306进程[root@lnh ~]# ps -ef |grep 3306 |grep -v greproot 71742 1 0 15:49 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/data/3306 --port=3306 --socket=/tmp/mysql3306.sock --pid-file=/opt/data/3306/mysql_3306.pid --log-error=/var/log/3306.logmysql 71878 71742 0 15:49 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/data/3306 --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/3306.log --pid-file=/opt/data/3306/mysql_3306.pid --socket=/tmp/mysql3306.sock --port=3306//取反[root@lnh ~]# ps -ef |grep 3306 |grep -v grep |awk '{print$2}'7174271878//取出端口号[root@lnh ~]# ps -ef |grep 3306 |grep -v grep |awk '{print$2}'|xargs kill -9 //xargs将前面的结果交给后面的来处理//杀死了端口号,相当于这个命令可以控制服务停止[root@lnh ~]# ps -ef |grep 3307 |grep -v grep |awk '{print$2}'|xargs kill -9[root@lnh ~]# ps -ef |grep 3308 |grep -v grep |awk '{print$2}'|xargs kill -9[root@lnh ~]# ss -antlstate recv-q send-q local address:port peer address:port process listen 0 128 0.0.0.0:22 0.0.0.0:* listen 0 128 [::]:22 [::]:* //端口号都被杀死
加入system服务里面[root@lnh system]# cd[root@lnh ~]# cd /usr/lib/systemd/system[root@lnh system]# cp sshd.service 3306.service[root@lnh system]# cp sshd.service 3307.service[root@lnh system]# cp sshd.service 3308.service[root@lnh system]# vim 3306.service [unit]description=3306 server daemonafter=network.target sshd-keygen.target[service]type=forkingexecstart=/usr/local/mysql/bin/mysqld_multi start 3306 //开启的位置execstop=ps -ef |grep 3306 |grep -v grep |awk '{print$2}'|xargs kill -9 //关闭的命令execreload=/bin/kill -hup $mainpid[install]wantedby=multi-user.target[root@lnh system]# cp 3306.service 3307.service cp: overwrite '3307.service'? y[root@lnh system]# vim 3307.service [unit]description=3307 server daemonafter=network.target sshd-keygen.target[service]type=forkingexecstart=/usr/local/mysql/bin/mysqld_multi start 3307execstop=ps -ef |grep 3307 |grep -v grep |awk '{print$2}'|xargs kill -9execreload=/bin/kill -hup $mainpid[install]wantedby=multi-user.target//快捷键 :% s/6/7/g 直接将6变成7[root@lnh system]# cp 3306.service 3308.service cp: overwrite '3308.service'? y[root@lnh system]# vim 3308.service [unit]description=3308 server daemonafter=network.target sshd-keygen.target[service]type=forkingexecstart=/usr/local/mysql/bin/mysqld_multi start 3308execstop=ps -ef |grep 3308 |grep -v grep |awk '{print$2}'|xargs kill -9execreload=/bin/kill -hup $mainpid[install]wantedby=multi-user.target//快捷键 :% s/6/8/g 直接将6变成8[root@lnh system]# systemctl daemon-reload //加载一下[root@lnh system]# systemctl stop firewalld[root@lnh system]# systemctl disable firewalld.service removed /etc/systemd/system/multi-user.target.wants/firewalld.service.removed /etc/systemd/system/dbus-org.fedoraproject.firewalld1.service.[root@lnh system]# vim /etc/selinux/config selinux=disabled //修改[root@lnh system]# setenforce 0//关闭防火墙[root@lnh system]# systemctl start 3306[root@lnh system]# systemctl start 3307[root@lnh system]# systemctl start 3308[root@lnh system]# ss -antlstate recv-q send-q local address:port peer address:port process listen 0 128 0.0.0.0:22 0.0.0.0:* listen 0 128 [::]:22 [::]:* listen 0 80 *:3306 *:* listen 0 80 *:3307 *:* listen 0 80 *:3308 *:* //可以发现全部启动成功//如果启动失败就在这个里面journalctl -xe找出错误点
初始化密码[root@lnh ~]# cat 3306aqlde*a:o8fr //查看之前放置的密码[root@lnh ~]# mysql -uroot -p'aqlde*a:o8fr' -s /tmp/mysql3306.sock mysql: [warning] using a password on the command line interface can be insecure.welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 2server version: 5.7.38copyright (c) 2000, 2022, oracle and/or its affiliates.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> set password=password('3306'); //修改密码query ok, 0 rows affected, 1 warning (0.00 sec)mysql> quitbye[root@lnh ~]# mysql -uroot -p'3306' -s /tmp/mysql3306.sockmysql: [warning] using a password on the command line interface can be insecure.welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 3server version: 5.7.38 mysql community server (gpl)copyright (c) 2000, 2022, oracle and/or its affiliates.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> //登录成功[root@lnh ~]# cat 3307 pajbo+gxg19i[root@lnh ~]# mysql -uroot -p'pajbo+gxg19i' -s /tmp/mysql3307.sockmysql: [warning] using a password on the command line interface can be insecure.welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 3server version: 5.7.38copyright (c) 2000, 2022, oracle and/or its affiliates.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> set password=password('3307'); //修改密码query ok, 0 rows affected, 1 warning (0.00 sec)mysql> quitbye[root@lnh ~]# mysql -uroot -p'3307' -s /tmp/mysql3307.sockmysql: [warning] using a password on the command line interface can be insecure.welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 4server version: 5.7.38 mysql community server (gpl)copyright (c) 2000, 2022, oracle and/or its affiliates.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> //登录成功[root@lnh ~]# cat 3308 =w&lnu)d-7kk[root@lnh ~]# mysql -uroot -p'=w&lnu)d-7kk' -s /tmp/mysql3308.sockmysql: [warning] using a password on the command line interface can be insecure.welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 2server version: 5.7.38copyright (c) 2000, 2022, oracle and/or its affiliates.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> set password=password('3308'); //修改密码query ok, 0 rows affected, 1 warning (0.00 sec)mysql> quitbye[root@lnh ~]# mysql -uroot -p'3308' -s /tmp/mysql3308.sockmysql: [warning] using a password on the command line interface can be insecure.welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 3server version: 5.7.38 mysql community server (gpl)copyright (c) 2000, 2022, oracle and/or its affiliates.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql> //登录成功
报错解决报错1:
[root@lnh ~]# mysql -uroot -p'aqlde*a:o8fr'
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: no such file or directory
//没有这个包
解决:
[root@lnh ~]# dnf provides libncurses.so.5
last metadata expiration check: 2:39:05 ago on sun 31 jul 2022 02:13:54 pm cst.
ncurses-compat-libs-6.1-9.20180224.el8.i686 : ncurses compatibility libraries
repo        : base
matched from:
provide    : libncurses.so.5
[root@lnh ~]# dnf -y install ncurses-compat-libs-6.1-9.20180224.el8.
报错2:
[root@lnh ~]# mysql -uroot -p'aqlde*a:o8fr'
mysql: [warning] using a password on the command line interface can be insecure.
error 2002 (hy000): can't connect to local mysql server through socket '/tmp/mysql.sock' (2)   //没有访问到套接字
解决:[root@lnh ~]# mysql -uroot -p'aqlde*a:o8fr' -s  /tmp/mysql3306.sock 
以上就是mysql多实例如何部署的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product