下载链接:
链接:https://pan.baidu.com/s/1UvB1iqQUcL9JFPTfLHjiFg
提取码:fuyo
复制这段内容后打开百度网盘手机App,操作更方便哦
# 创建mysql用户组和用户
groupadd mysql
useradd -r -g mysql mysql
# 解压 官网下载文件
tar xzvf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz
# 在/usr/local下新建文件夹mysql 然后运行下面命令
mv /usr/local/mysql-5.7.24-linux-glibc2.12-x86_64/* /usr/local/mysql
# 在/usr/local/mysql目录下创建data目录
mkdir /usr/local/mysql/data
# 更改mysql目录下所有的目录及文件夹所属的用户组和用户,以及权限
chown -R mysql:mysql /usr/local/mysql
chmod -R 777 /usr/local/mysql
# 安装依赖
yum install libaio-devel.x86_64
yum -y install numactl
# 编译安装并初始化mysql,务必记住初始化输出日志末尾的密码(数据库管理员临时密码)
cd /usr/local/mysql/bin
./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
# 编辑配置文件my.cnf,删除文件里的其他配置 vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
port=3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
max_connections=10000
innodb_file_per_table=1
lower_case_table_names=1
character_set_server=utf8
# 启动
/usr/local/mysql/support-files/mysql.server start
# 添加软连接,并重启mysql服务
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
service mysql restart
# 登录mysql,修改密码(上面步骤生成的临时密码) mysql -u root -p | mysql -h 服务器ip -u root -p -P 3306
set password for root@localhost = password('你的新密码');
# 开放远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的新密码' WITH GRANT OPTION;
网友评论