2013年(13)
分类: Mysql/postgreSQL
2013-09-26 11:32:36
| cd /usr/local/src |
| 02 | wget |
| 03 | wget |
| 04 |
| 05 | #安装之前应该先查询系统是否自在了mysql的软件包 rpm -qa|grep -i mysql |
| 06 | #如果有的话需要先删除 rpm -e 软件名 --nodeps |
| 07 |
| 08 | rpm -ivh MySQL-server-5.6.13-1.el6.x86_64.rpm |
| 09 | rpm -ivh MySQL-client-5.6.13-1.el6.x86_64.rpm |
| 10 |
| 11 |
| 12 | #安装后生成的一个随机密码在 /root/.mysql_secret |
| 13 | #启动 MySQL |
| 14 | service mysql start |
| 15 |
| 16 | #登录mysql |
| 17 | mysql -u root -p |
| 18 |
| 19 | #修改密码 |
| 20 | SET PASSWORD=password('password'); |
| 21 |
| 22 | #添加一个可远程登录的帐号 |
| 23 | GRANT all privileges on *.* TO 'root'@'%' identified by 'password' WITH GRANT OPTION; |
| 24 | FLUSH PRIVILEGES; |
| 25 | #修改密码 |
| 26 | SET PASSWORD FOR 'root'@'%' = PASSWORD('password'); |
| 27 |
| 28 |
| 29 | ######################################### |
| 30 |
| 31 | #可运行此脚本 进行生产服务器安全配置 |
| 32 | /usr/bin/mysql_secure_installation |
| 33 |
| 34 |
| 35 | #Enter current password for root 输入root密码 |
| 36 | #Change the root password? 是否修改root的密码 |
| 37 | #Remove anonymous users? 是否删除匿名账号 |
| 38 | #Disallow root login remotely? 是否取消root用户远程登录 |
| 39 | #Remove test database and access to it? 是否删除test库和对test库的访问权限 |
| 40 | #Reload privilege tables now? 是否现在刷新授权表使修改生效 |