linux CentOS6.5 yum安装mysql 5.6-Csslinux
1.检测系统是否自带安装mysql# yum list installed | grep mysql 2.若已装过要先将其删除
# yum -y remove mysql-libs.x86_64 //这个会删除依赖包
# rpm -e --nodeps mysql //加--nodeps不删除依赖
3.下载官方mysql对应版本的yum源
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm 4.安装下载的rpm包
这个rpm还不是mysql的安装文件,只是yum源文件
# rpm -ivh mysql-community-release-el6-5.noarch.rpm 5.安装成功后,我们可以看到/etc/yum.repos.d/目录下增加了以下两个文件
1 # ls /etc/yum.repos.d
2 mysql-community-source.repo
3 mysql-community.repo
6.查看mysql的安装源是否可用,如不可用请自行修改配置文件(/etc/yum.repos.d/mysql-community.repo)
使mysql57下面的enable=1若有mysql其它版本的安装源可用,也请自行修改配置文件使其enable=0
# yum repolist all | grep mysql
# yum repolist enabled | grep mysql
mysql-connectors-community MySQL Connectors Community 13
mysql-tools-community MySQL Tools Community 18
mysql57-community-dmr MySQL 5.7 Community Server Development Milesto 65
7.使用yum安装mysql:
# yum install -y mysql-community-server 8.查看mysqld是否开机自启动,并设置为开机自启动:
1 chkconfig --list | grep mysqld
2 chkconfig mysqld on
9.修改字符集为UTF-8:
vim /etc/my.cnf 在部分添加:
character-set-server=utf8 在文件末尾新增段,并在段添加:
default-character-set=utf8 10.安装成功后启动mysql服务
# service mysqld start 11.mysql的root用户的密码默认是空的,需要及时用mysql的root用户登录(第一次回车键,不用输入密码),并修改密码
# mysql -u root
# use mysql;
# update user set password=PASSWORD("这里输入root用户密码") where User='root';
# flush privileges;
12.mysql安全设置:
# mysql_secure_installation 参考文章:https://www.cnblogs.com/renjidong/p/7047396.html
页:
[1]