話不多說,直接上代碼 分割線 [root@ip-172-31-9-121 ec2-user]# yum install mysql [root@ip-172-31-9-121 ec2-user]# yum install mysql-server tips:如果出現以下代碼,就需要下載mysql-s ...
話不多說,直接上代碼
------------------------------------------分割線-------------------------------------------------------------
[root@ip-172-31-9-121 ec2-user]# yum install mysql
[root@ip-172-31-9-121 ec2-user]# yum install mysql-server
tips:如果出現以下代碼,就需要下載mysql-server的rpm包,
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package mysql-server available.
[root@ip-172-31-9-121 homt]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
[root@ip-172-31-9-121 homt]# yum install mysql-devel
然後修改許可權:
[root@ip-172-31-9-121 homt]# chgrp -R mysql /var/lib/mysql
[root@ip-172-31-9-121 homt]# chmod -R 770 /var/lib/mysql
啟動mysql服務:
[root@ip-172-31-9-121 homt]# service mysqld start
設置mysql 密碼
[root@ip-172-31-9-121 homt]# /usr/bin/mysql -u root password '123456'
測試mysql是否安裝成功(進入需要輸入密碼 表示成功):
[root@ip-172-31-9-121 homt]# mysql