标签:ali 上传 $path sbin lock err rip glibc 模式
系统 :CentOS-7-x86_64-DVD-1810.iso
数据库版本:mysql-5.7.26
root@mysql_01 ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.60-1.el7_5.x86_64
[root@mysql_01 ~]# yum remove mariadb-libs -y
[root@mysql_01 ~]# useradd mysql -s /sbin/nologin
[root@mysql_01 ~]# id mysql
uid=1000(mysql) gid=1000(mysql) groups=1000(mysql)
# 创建软件目录
mkdir -p /app/database/
# 创建数据目录
mkdir -p /data/3306
# 创建日志目录
mkdir -p /binlog/3306
chown -R mysql.mysql /app/ /data/ /binlog/
[root@mysql_01 ~]# cd /app/database/
[root@mysql_01 database]# ls
mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
[root@mysql_01 database]# tar xf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
[root@mysql_01 database]# ll
total 629756
drwxr-xr-x 9 root root 129 Apr 29 13:50 mysql-5.7.26-linux-glibc2.12-x86_64
-rw-r--r-- 1 root root 644869837 Apr 29 13:49 mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
[root@mysql_01 database]# ln -s mysql-5.7.26-linux-glibc2.12-x86_64 mysql
[root@mysql_01 database]# ll
total 629756
lrwxrwxrwx 1 root root 35 Apr 29 13:51 mysql -> mysql-5.7.26-linux-glibc2.12-x86_64
drwxr-xr-x 9 root root 129 Apr 29 13:50 mysql-5.7.26-linux-glibc2.12-x86_64
-rw-r--r-- 1 root root 644869837 Apr 29 13:49 mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
[root@mysql_01 database]# cd mysql
[root@mysql_01 mysql]# ll
total 36
drwxr-xr-x 2 mysql mysql 4096 Apr 29 13:50 bin
-rw-r--r-- 1 mysql mysql 17987 Apr 13 2019 COPYING
drwxr-xr-x 2 mysql mysql 55 Apr 29 13:50 docs
drwxr-xr-x 3 mysql mysql 4096 Apr 29 13:50 include
drwxr-xr-x 5 mysql mysql 230 Apr 29 13:50 lib
drwxr-xr-x 4 mysql mysql 30 Apr 29 13:50 man
-rw-r--r-- 1 mysql mysql 2478 Apr 13 2019 README
drwxr-xr-x 28 mysql mysql 4096 Apr 29 13:50 share
drwxr-xr-x 2 mysql mysql 90 Apr 29 13:50 support-files
vim /etc/profile
# 添加一行
export PATH=/app/database/mysql/bin:$PATH
# 生效配置
source /etc/profile
# 使用mysql -V打印出数据库版本说明环境变量配置成功
[root@mysql_01 mysql]# mysql -V
mysql Ver 14.14 Distrib 5.7.26, for linux-glibc2.12 (x86_64) using EditLine wrapper
[root@mysql_01 mysql]# mysqld --initialize-insecure --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
# 报错
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
# 解决
[root@mysql_01 mysql]# yum install -y libaio-devel
# 再次运行
[root@mysql_01 mysql]# mysqld --initialize-insecure --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
mysqld --initialize
mysqld --initialize-insecure
/app/database/mysql/scripts/mysql_install_db --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
cat >/etc/my.cnf <<EOF
[mysqld]
user=mysql
basedir=/app/database/mysql
datadir=/data/3306/
server_id=6
port=3306
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock
EOF
[root@mysql_01 app]# cd /app/database/mysql/support-files
# 拷贝MySQL启动脚本至系统软件管理目录中
[root@mysql_01 support-files]# cp mysql.server /etc/init.d/mysqld
# centos 6
[root@mysql_01 ~]# service mysqld restart
ERROR! MySQL server PID file could not be found!
Starting MySQL.Logging to ‘/data/3306/mysql_01.err‘.
SUCCESS!
# centos 7
[root@mysql_01 ~]# /etc/init.d/mysqld stop
Shutting down MySQL.. SUCCESS!
[root@mysql_01 ~]# systemctl start mysqld
[root@mysql_01 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.26 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>
标签:ali 上传 $path sbin lock err rip glibc 模式
原文地址:https://www.cnblogs.com/qiuxirufeng/p/12806473.html