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带来的乐趣了。
本文出自 “自信蜗牛” 博客,谢绝转载!
胡总版
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;