资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

AWS中怎么安装Mysql

AWS中怎么安装MySQL,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

创新互联公司是一家集网站建设,上虞企业网站建设,上虞品牌网站建设,网站定制,上虞网站建设报价,网络营销,网络优化,上虞网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

第一步: 切换到root账户

sudo -s

更换时区为东八区(北京时间)

mv /etc/localtime /etc/localtime.bak 
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

第二步: 需要更新一下yum(因为亚马逊的yum版本经常都是晚于潮流)

yum update

第三步: 安装mysql

yum install -y mysql57-server

如果提示 Unable to find a match: mysql57-server则需要去mysql官网获取下安装包

//下载
sudo rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
//安装
sudo yum install mysql-server

第四步: 启动mysql

service mysqld start
#设置开机自启动
chkconfig mysqld on

第五步: 做一些基础配置

mysql_secure_installation

下面的内容会比较多,其实就几个

[root@ip-172-31-35-183 ec2-user]# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

#询问你是否启用密码校验
Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

#询问你要使用什么强度的密码,输入0就可以使用任意密码,还有 1和2可选自己看上两行的强度要求
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.
#输入你的密码
New password: 
#再次数据你的密码
Re-enter new password: 
#这行是评价你设定密码的强度,可以忽略
Estimated strength of the password: 50 
#上一行评价了你的密码强度,如果你觉得不够,你可以输入n重新设置密码,如果对自己的密码满意就输入y,确认使用新密码
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
#询问你是否删除所有匿名用户,直接选y即可,不需要多想(要多想也随意)
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
#问你是否要禁用root账户的远程连接,如果禁用了你就只能玩单机操作了,所以选择 n
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

#问你要不要删除所有测试数据,数据库新装会有一些默认的测试数据,删不删没影响,y和n随意
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
#问你要不要更新配置(屁话,设置这么辛苦肯定马上更新使用了) y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

第六步: 使用刚设置的密码登入数据库,修改远程ip权限

mysql -u root -p

设置用户 root 可以在任意 IP 下被访问:

grant all privileges on *.* to root@"%" identified by "你的密码";

设置用户 root 可以在本地被访问:

grant all privileges on *.* to root@"localhost" identified by "你的密码";

设置完访问权限后,需要刷新一下

flush privileges

至此结束

关于AWS中怎么安装Mysql问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。


当前名称:AWS中怎么安装Mysql
标题来源:http://cdkjz.cn/article/pjidgd.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220