linux下mysql

mysql卸载:http://www.cnblogs.com/zhangzhen894095789/p/6443227.html

mysql安装:http://www.mamicode.com/info-detail-1166036.html

wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

 

查看包里面的内容

[root@bogon ~]# rpm -qplmysql57-community-release-el6-7.noarch.rpm

/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

/etc/yum.repos.d/mysql-community-source.repo

/etc/yum.repos.d/mysql-community.repo

 

查看yum列表

yum list |grep mysql

 

安装MySQL

yum install mysql-client mysql-server

 

启动MySQL服务

[root@bogon ~]# service mysqld start

 

查看初始密码

[root@bogon ~]# grep ‘temporary password‘/var/log/mysqld.log

 

进行初始的安全设置

[root@bogon ~]# cd /usr/bin/

[root@bogon bin]# mysql_secure_installation

设置如下内容:

重置密码

删除匿名用户

删除测试数据库

关闭root用户的远程登录

 

[root@bogon bin]# mysql_secure_installation

 

Securing the MySQL server deployment.

 

Enter password for user root:

 

The existing password for the user accountroot has expired. Please set a new password.

 

New password:

 

Re-enter new password:

 ...Failed! Error: Your password does not satisfy the current policy requirements

 

New password:

 

Re-enter new password:

The ‘validate_password‘ plugin is installedon the server.

The subsequent steps will run with theexisting configuration

of the plugin.

Using existing password for root.

 

Estimated strength of the password: 100

Change the password for root ? ((Press y|Yfor Yes, any other key for No) : y

 

New password:

 

Re-enter new password:

 

Estimated strength of the password: 100

Do you wish to continue with the passwordprovided?(Press y|Y for Yes, any other key for No) : y

By default, a MySQL installation has ananonymous user,

allowing anyone to log into MySQL withouthaving to have

a user account created for them. This isintended only for

testing, and to make the installation go abit smoother.

You should remove them before moving into aproduction

environment.

 

Remove anonymous users? (Press y|Y for Yes,any other key for No) : y

Success.

 

 

Normally, root should only be allowed toconnect from

‘localhost‘. This ensures that someonecannot guess at

the root password from the network.

 

Disallow root login remotely? (Press y|Yfor Yes, any other key for No) : n

 

 ...skipping.

By default, MySQL comes with a databasenamed ‘test‘ that

anyone can access. This is also intendedonly for testing,

and should be removed before moving into aproduction

environment.

 

 

Remove test database and access to it?(Press y|Y for Yes, any other key for No) : n

 

 ...skipping.

Reloading the privilege tables will ensurethat all changes

made so far will take effect immediately.

 

Reload privilege tables now? (Press y|Y forYes, any other key for No) : y

Success.

 

All done!(提示全部设置完毕)

 

然后你就可以享受MySQL带来的乐趣了。


本文出自 “自信蜗牛” 博客,谢绝转载!

胡总版

 #download mysql57-community-release-el6-8.noarch.rpm from mysql
wget  http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm 

sudo rpm -ivh mysql57-community-release-el6-8.noarch.rpm 
sudo yum install mysql-server
yum list installed |grep mysql
service mysqld restart
rpm -ql mysql-community-server 

grep 'temporary password' /var/log/mysqld.log

#create user
use mysql
update user set authentication_string=password('root#123') where user='root';
FLUSH PRIVILEGES;

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root#12345';
CREATE USER 'root'@'%' IDENTIFIED BY 'Root#12345';
FLUSH PRIVILEGES; 

yum方式安装My


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值