Linux安装Mysql5.6
Centos安装Mysql5.6
一、准备工作
1.删除系统存在的Mysql
1 | If you have previously installed MySQL using your operating system native |
2.操作系统依赖包
yum install libaio
3.查看glibc版本
ldd --version|head -1
4.下载二进制安装包
1 | wget -c https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz |
5.安装步骤
1 | shell> groupadd mysql |
6.Mysql目录结构
| Directory | Contents of Directory |
|---|---|
bin, scripts |
mysqld server, client and utility programs |
data |
Log files, databases |
docs |
MySQL manual in Info format |
man |
Unix manual pages |
include |
Include (header) files |
lib |
Libraries |
share |
Miscellaneous support files, including error messages, sample configuration files, SQL for database installation |
sql-bench |
Benchmarks |
二、安装
1.创建用户和组
1 | groupadd -g 10000 mysql |
2.解压安装包
1 | # tar zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz -C /usr/local/ |
3.创建软件链接
1 | # cd /usr/local/ |
4.初如化目录
1 | # cd mysql |
5.配置my.cnf参数文件
1 | # vi /etc/my.cnf |
6.添加PATH环境变量
1 | # vim /etc/profile |
7.配置启动文件
1 | # cp support-files/mysql.server /etc/init.d/mysql |
8.启动Mysql
1 | # mysqld_safe --user=mysql & |
| 启动命令 | 关闭命令 |
|---|---|
| mysqld –user=mysql & | mysqladmin -uroot -p shutdown |
| mysqld_safe –user=mysql & | mysqladmin -uroot -p shutdown |
| /etc/init.d/mysql start | /etc/init.d/mysql stop |
9.设置root密码
1 | # mysqladmin -uroot password '123456' |
10.删除test库相关信息
1 | # mysql_secure_installation |
- Title: Linux安装Mysql5.6
- Author: 𝓓𝓸𝓷
- Created at : 2024-06-13 19:28:09
- Updated at : 2025-01-08 09:49:29
- Link: https://www.zhangdong.me/mysql5.6-installation.html
- License: This work is licensed under CC BY-NC-SA 4.0.
评论
