MySQL5.6,MySQL8.0二进制安装
程序员文章站
2022-04-17 16:00:12
...
MySQL5.6安装
解压到目录下
[[email protected] local]# ll mysql56
total 44
drwxr-xr-x 2 mysql mysql 4096 Nov 11 19:17 bin
-rw-r--r-- 1 mysql mysql 17987 Mar 15 2019 COPYING
drwxr-xr-x 2 mysql mysql 55 Nov 11 19:16 docs
drwxr-xr-x 3 mysql mysql 4096 Nov 11 19:16 include
drwxr-xr-x 3 mysql mysql 316 Nov 11 19:16 lib
drwxr-xr-x 4 mysql mysql 30 Nov 11 19:16 man
-rw-r--r-- 1 root root 1190 Nov 11 20:47 my.cnf
drwxr-xr-x 10 mysql mysql 291 Nov 11 19:16 mysql-test
-rw-r--r-- 1 mysql mysql 2496 Mar 15 2019 README
drwxr-xr-x 2 mysql mysql 30 Nov 11 20:22 scripts
drwxr-xr-x 28 mysql mysql 4096 Nov 11 19:17 share
drwxr-xr-x 4 mysql mysql 4096 Nov 11 19:16 sql-bench
drwxr-xr-x 2 mysql mysql 136 Nov 11 20:32 support-files
创建数据目录及授权
mkdir /data/mysql56/data -p
chown -R mysql.mysql mysql56
编写配置文件
[[email protected] mysql56]# cat mysql56.cnf
[mysqld]
basedir=/usr/local/mysql56
datadir=/data/mysql56/data
socket=/tmp/mysql56.sock
user=mysql
log_error=/tmp/mysql56.log
skip_name_resolve
log_bin=/data/mysql56/mysql-bin
port=3307
准备启动脚本
[[email protected] system]# cat mysqld56.service
[Unit]
Description=MySQL Server
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql56/bin/mysqld --defaults-file=/data/mysql56/mysql56.cnf
初始化数据
/usr/local/mysql56/scripts/mysql_install_db --user=mysql --datadir=/data/mysql56/data --basedir=/usr/local/mysql56
启动
[[email protected] system]# systemctl start mysqld56
[[email protected] system]# mysql -S /tmp/mysql56.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.44-log MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
MySQL8.0安装
解压文件到目录
[[email protected] local]# ll mysql80/
total 448
drwxr-xr-x 2 mysql mysql 4096 Apr 14 2019 bin
drwxr-xr-x 2 mysql mysql 86 Apr 14 2019 docs
drwxr-xr-x 3 mysql mysql 261 Apr 14 2019 include
drwxr-xr-x 6 mysql mysql 4096 Apr 14 2019 lib
-rw-r--r-- 1 mysql mysql 335809 Apr 13 2019 LICENSE
-rw-r--r-- 1 mysql mysql 101807 Apr 13 2019 LICENSE.router
drwxr-xr-x 4 mysql mysql 30 Apr 14 2019 man
-rw-r--r-- 1 mysql mysql 687 Apr 13 2019 README
-rw-r--r-- 1 mysql mysql 700 Apr 13 2019 README.router
drwxrwxr-x 2 mysql mysql 6 Apr 14 2019 run
drwxr-xr-x 28 mysql mysql 4096 Apr 14 2019 share
drwxr-xr-x 2 mysql mysql 77 Apr 14 2019 support-files
drwxr-xr-x 3 mysql mysql 17 Apr 14 2019 var
创建目录及授权
mkdir /data/mysql80/data -p
chown -R mysql.mysql mysql80
编写配置文件
[[email protected] mysql80]# cat mysql80.cnf
[mysqld]
basedir=/usr/local/mysql80
datadir=/data/mysql80/data
user=mysql
port=3380
socket=/tmp/mysql80.socket
log_error=/tmp/mysql80.log
log_bin=/data/mysql80/mysql-bin
skip_name_resolve
加入systemd管理
[[email protected] system]# cat mysqld80.service
[Unit]
Description=MySQL Server
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql80/bin/mysqld --defaults-file=/data/mysql80/mysql80.cnf
初始化
/usr/local/mysql80/bin/mysqld --initialize-insecure --user=mysql --datadir=/data/mysql80/data --basedir=/usr/local/mysql80
启动
systemctl start mysqld80
ss -tlunp|grep 3380
tcp LISTEN 0 128 :::3380 :::* users:(("mysqld",pid=27726,fd=29))
上一篇: jQuery中odd选择器的定义和用法_jquery
下一篇: 死锁的产生及解决