1、实战:通用二进制格式安装 MySQL(mysql-5.6.47)-2024.4.6(测试成功)
1、实战:通用二进制格式安装 MySQL(mysql-5.6.47)-2024.4.6(测试成功)
目录
[toc]
实验环境
链接:https://pan.baidu.com/s/1Fl4duisOKh3QdjDC81V9jA?pwd=17ev
提取码:17ev
2024.4.6-实战:通用二进制格式安装 MySQL(mysql-5.6.47)-2024.4.6(测试成功)
1、下载url
https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.47-linux-glibc2.12-x86_64.tar.gz
2、准备用户
[root@linux-test ~]#groupadd -r -g 306 mysql
[root@linux-test ~]#useradd -r -g 306 -u 306 -d /data/mysql mysql
3、准备数据目录,建议使用逻辑卷
#可选做,后面的脚本mysql_install_db可自动生成此目录(推荐还是这里做了为好)
[root@linux-test ~]#mkdir -p /data/mysql
[root@linux-test ~]#chown mysql:mysql /data/mysql
4、准备二进制程序
[root@linux-test ~]#tar xvf mysql-5.6.47-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
[root@linux-test ~]#cd /usr/local
[root@linux-test local]#ln -s mysql-5.6.47-linux-glibc2.12-x86_64/ mysql
[root@linux-test local]#chown -R root:root /usr/local/mysql/
5、准备配置文件
[root@linux-test ~]#cd /usr/local/mysql
[root@linux-test mysql]#vim /etc/my.cnf
[mysqld]
datadir = /data/mysql
#保存退出,其他不行代表保持默认
⚠️ 注意:这里的方法和版本有关系
cd /usr/local/mysql
cp -b support-files/my-large.cnf /etc/my.cnf
其它:
vim /etc/my.cnf
#mysql语句块中添加以下三个选项
[mysqld]
datadir = /data/mysql
innodb_file_per_table = on #在mariadb5.5以上版的是默认值,可不加
skip_name_resolve = on #禁止主机名解析,建议使用