CenterOS7在线yum安装MySQL
1.安装rpm包
[[email protected] ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
· Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-release-el7-5 ################################# [100%]
·
·
查看当前可用的mysql安装资源:
2. [ [email protected] ~]# yum repolist enabled | grep "mysql.*-community.*"
!mysql-connectors-community/x86_64 MySQL Connectors Community 2
!mysql-tools-community/x86_64 MySQL Tools Community 3
!mysql56-community/x86_64 MySQL 5.6 Community Server 22
3.[ [email protected] ~]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
epel/x86_64/metalink | 4.9 kB 00:00
extras | 3.4 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql56-community | 2.5 kB 00:00
updates | 3.4 kB 00:00
updates/7/x86_64/primary_db | 4.9 MB 00:05
·
……………………
·
·
Installing : mysql-community-common-5.6.30-2.el7.x86_64 1/4
Installing : mysql-community-libs-5.6.30-2.el7.x86_64 2/4
Installing : mysql-community-client-5.6.30-2.el7.x86_64 3/4
Installing : mysql-community-server-5.6.30-2.el7.x86_64 4/4
Verifying : mysql-community-client-5.6.30-2.el7.x86_64 1/4
Verifying : mysql-community-common-5.6.30-2.el7.x86_64 2/4
Verifying : mysql-community-libs-5.6.30-2.el7.x86_64 3/4
Verifying : mysql-community-server-5.6.30-2.el7.x86_64 4/4
Installed:
mysql-community-server.x86_64 0:5.6.30-2.el7
Dependency Installed:
mysql-community-client.x86_64 0:5.6.30-2.el7 mysql-community-common.x86_64 0:5.6.30-2.el7 mysql-community-libs.x86_64 0:5.6.30-2.el7
Complete!
·
·
·
·
#######安装成功后,将其加入开机启动
4.[[email protected] ~]# systemctl enable mysqld
·
#######启动mysql服务进程
5.[[email protected] ~]# systemctl start mysqld
·
#######配置mysql(设置密码等)
6.[[email protected] ~]# mysql_secure_installation
Mysql授权连接
授权方式--你想myuser使用mypassword从任何主机连接到mysql服务器的话
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;