启动httpd服务
mkdir -p /run/httpd
systemctl start httpd.service
在linux系统中代表:多个进程+多个线程+多个预分配内存结构
一般用来测试环境中,测试主从,高可用等。
多实例配置方案:(多个数据库管理系统)
端口port分开 配置文件分开 socket分开 日志分开 多serverid 都可以使用mysql用户 #总结,初始化多次数据库
创建目录修改权限
mkdir /share/work/mysql mkdir /share/work/mysql/3306
chown mysql:mysql -R /share/work/mysql
修改mysql配置文件,执行“vi /share/work/mysql/3306/my.cnf ”命令并确定。
cp /etc/my.cnf /share/work/mysql
[mysqld]
basedir=/opt/rocks/mysql
datadir=/share/work/mysql/3306/data
port=3306
socket=/share/work/mysql/3306/mysql.sock
log-error=/share/work/mysql/3306/data/mysql.err
log-bin=/share/work/mysql/3306/data/mysql-bin
server_id=7
安装数据库
groupadd mysql
useradd -r -g mysql mysql
cd /opt/rocks/mysql/scripts/./mysql_install_db --defaults-file=/share/work/mysql/3306/my.cnf --user=mysql --basedir=/opt/rocks/mysql --datadir=/share/work/mysql/3306/data #启动 /opt/rocks/mysql/bin/mysqld_safe --defaults-file=/share/work/mysql/3306/my.cnf --skip-grant-tables
设置开机启动:
初始化密码并且授权远程登录
mysqladmin -u root password "pwd3306" -S /share/work/mysql/3306/mysql.sock
mysql -uroot -ppwd3306 -S /share/work/mysql/3306/mysql.sock
mysql> grant all privileges on *.* to 'root'@'%' identified by 'pwd3306' with grant option;
mysql> flush privileges;
#6.关闭多实例
[root@db01 scripts]# mysqladmin -S /share/work/mysql/3306/mysql.sock shutdown
#7.检查端口
[root@db01 scripts]# netstat -lntup|grep 330
tcp6 0 0 :::3306 :::* LISTEN 25550/mysqld
#8.设置多实例密码
[root@db01 scripts]# mysqladmin -uroot -S /share/work/mysql/3306/mysql.sock password '3306'
#9.验证库连接( 查看server_id )
[root@db01 scripts]# mysql -uroot -p3306 -S /share/work/mysql/3306/mysql.sock -e "show variables like 'server_id';"Warning: Using a password on the command line interface can be insecure.
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id | 7 |
+---------------+-------+
https://www.cnblogs.com/longren/p/11168317.html
参考这里:https://www.jb51.net/article/133836.htm
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!