2018.06.09 - CentOS 7 安装mysql 5.6

系统环境:CentOS 7 最小化安装版

rpm-qd | grep -i mysql    #检查mysqlrpm相关的包是否安装,如安装则删除。

rpm-ivh http://repo.mysql.com/yum/mysql-5.5-community/el/6/x86_64/mysql-community-release-el6-5.noarch.rpm    #导入mysql5.6的源

yumrepolist enabled | grep "mysql.*-community.*"    #查看当前可用的mysql安装资源

yuminstall mysql-server mysql-client mysql-devel   #安装mysql

mysqladmin–version    #查看mysql版本信息

systemctlstart mysqld    #开启mysql服务

systemctlenable mysqld    #设置mysql开机启动

systemctlstatus mysqld    #查看mysql运行状态

mysql_secure_installation    #重置密码

NOTE:RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

Inorder to log into MySQL to secure it, we'll need the current

passwordfor the root user.  If you've justinstalled MySQL, and

youhaven't set the root password yet, the password will be blank,

soyou should just press enter here.

Entercurrent password for root (enter for none):

OK,successfully used password, moving on...

Settingthe root password ensures that nobody can log into the MySQL

rootuser without the proper authorisation.

Youalready have a root password set, so you can safely answer 'n'.

Changethe root password? [Y/n] y    #更改root密码

Newpassword:

Re-enternew password:

Passwordupdated successfully!

Reloadingprivilege tables..

 ... Success!

Bydefault, a MySQL installation has an anonymous user, allowing anyone

tolog into MySQL without having to have a user account created for

them.  This is intended only for testing, and tomake the installation

goa bit smoother.  You should remove thembefore moving into a

productionenvironment.

Removeanonymous users? [Y/n] y    #删除匿名用户

 ... Success!

Normally,root should only be allowed to connect from 'localhost'.  This

ensuresthat someone cannot guess at the root password from the network.

 

Disallowroot login remotely? [Y/n] n    #禁止root远程登陆

 ... skipping.

Bydefault, MySQL comes with a database named 'test' that anyone can

access.  This is also intended only for testing, andshould be removed

beforemoving into a production environment.

Removetest database and access to it? [Y/n] y   #删除test数据库

 - Dropping test database...

ERROR1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist

 ... Failed! Not critical, keep moving...

 - Removing privileges on test database...

 ... Success!

Reloadingthe privilege tables will ensure that all changes made so far

willtake effect immediately.

Reloadprivilege tables now? [Y/n] y    #刷新权限

 ... Success!

Alldone!  If you've completed all of theabove steps, your MySQL

installationshould now be secure.

Thanksfor using MySQL!

Cleaningup...

 

mysql-u root -p    #以root身份登陆
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值