cxxx
apt update && apt upgrade
apt-get install -y libaio1 libaio-dev libnuma1 libncurses5
将msyql包上传到服务器
本地下载:
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz
tar -zxvf mysql-5.7…
groupadd mysql
useradd -r -g mysql mysql
mv 解压后的包 /usr/local/mysql5.7
mkdir /usr/lib/mysql5.7/{data,log}
chown -R mysql.mysql /usr/lib/mysql5.7
上传my.cnf到/etc
#修改相应的目录
[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql5.7
datadir=/usr/local/mysql5.7/data
socket=/tmp/mysql.sock
log_error=/usr/local/mysql5.7/log/mysql.err
log_warnings = 2
pid_file=/usr/local/mysql5.7/mysql.pid
character_set_server=utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect=‘SET NAMES utf8mb4’
lower_case_table_names = 1
symbolic_links=0
explicit_defaults_for_timestamp=true
cd /usr/lib/mysql5.7
bin/mysqld --user=mysql --basedir=/usr/local/mysql5.7 --datadir=/usr/local/mysql5.7/data/ --initialize
配置环境变量
编辑/etc/profile文件
vim /etc/profile
最下添加如下语句
export PATH=$PATH:/usr/local/mysql-5.7.42/mysql/bin:/usr/local/mysql-5.7.42/mysql/lib
1
配置立即生效
source /etc/profile
查看初始密码:
cat /usr/local/mysql5.7/log/mysql.err |grep password
登录: