CentOS 7.3 官网离线安装mysql 5.5
程序员文章站
2022-05-27 19:07:05
...
安装环境
- CentOs 7.3
安装包下载
https://pan.baidu.com/s/1S6YL8ZaTI6tCJx6pdDAfUQ
运行命令
1.下载文件并上传
2.进入上传文件根目录
yum localinstall mysql57-community-release-el7-8.noarch.rpm
3:检查是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
显示正常如下:
[root@izwz9evdgm0j8lrd5ttie8z package]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 51
mysql-tools-community/x86_64 MySQL Tools Community 63
mysql57-community/x86_64 MySQL 5.7 Community Server 267
4:选择安装版本
vim /etc/yum.repos.d/mysql-community.repo
#### Enable to use MySQL 5.5 修改enabled 1(表示安装) 或 0(不安装)
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
5:启动mysql服务
systemctl start mysqld
6:开机启动
systemctl enable mysqld
systemctl daemon-reload
7:修改root 本地登录密码
1.grep 'temporary password' /var/log/mysqld.log 获取默认密码
2.set password for 'root'@'localhost'=password('chenzhanmei');
3.flush privileges;
注意: 如果密码忘记
vi /etc/my.conf
在[mysqld] 下面添加 skip-grant-tables
8:添加远程登录用户
GRANT ALL PRIVILEGES ON *.* TO 'zhanmei'@'%' IDENTIFIED BY 'Zhanmei1!' WITH GRANT OPTION;
9:配置默认编码为UTF8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置,如下所示:
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
10:默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log//var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
11:数据库优化 自行百度
版权声明:本文为博主原创文章,欢迎转载。转载时请注明作者及出处。
上一篇: [bzoj 4241]历史研究
下一篇: [bzoj 4241]历史研究