manjaro 安装 mysql 5.7

下载
https://www.mysql.com/downloads/

1
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

创建用户

1
2
3
4
groupadd mysql
useradd -r -g mysql mysql
chown -R mysql mysql/
chgrp -R mysql mysql/

初始化必要的目录

1
2
sudo mkdir /var/log/mysql
sudo chown mysql:mysql /var/log/mysql

配置文件

1
gedit /etc/mysql/my.cnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[client]
default-character-set=utf8
port = 3306
socket = /tmp/mysql.sock

[mysql]
default-character-set=utf8
port = 3306
socket = /tmp/mysql.sock

[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
log-error=/var/log/mysql/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#不区分大小写
lower_case_table_names = 1
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
max_connections=5000
default-time_zone = '+8:00'

# skip-grant-tables

初始化数据库

1
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

启动

1
/usr/local/mysql/support-files/mysql.server start

未完待续

参考:

1
https://www.cnblogs.com/ralap7/p/9034879.html