首先在官网下载mysql,解压放在/home/work/mysql

 

1 初始化
./bin/mysqld –initialize –basedir=/home/work/mysql/ –datadir=/home/work/mysql/data/ –explicit_defaults_for_timestamp=1 –character-sets-dir=/home/work/mysql/share/charsets/ –general-log-file=/home/work/mysql/var/lib/mysql/shhbxybtestdmz-g0405-vm23.log –lc-messages-dir=/home/work/mysql/share/ –socket=/home/work/mysql/var/lib/mysql/mysql.sock

2 上传my.cnf 到/home/work/mysql/

3 启动mysql服务
bin/mysqld –defaults-file=./my.cnf &

4 配置全局变量
vim ~/.bashrc
export PATH=$PATH:/home/work/mysql/bin

5 复制my.cnf到 /home/work/.my.cnf
cp my.cnf /home/work/.my.cnf

 

附 my.cnf 文件
“`
[client]
port = 3307
socket = /home/work/mysql/mysql.sock
default-character-set = utf8mb4

[mysqld]
port = 3307
socket = /home/work/mysql/mysql.sock
pid-file = /home/work/mysql/mysql.pid
basedir = /home/work/mysql/
datadir = /home/work/mysql/data/
tmpdir = /home/work/mysql/tmp/
#character_set_server = utf8mb4
#collation_server = utf8mb4_bin
user = work
lc-messages-dir=/home/work/mysql/share/
sql_mode = NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
“`


0 条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注