1、首先下载mysql的linux版本(注意,需要下载radha的版本)
MySQL-5.6.17-1.el6.i686.rpm-bundle.tar。本人只安装了MySQL-server-5.6.17-1.el6.i686.rpm 和MySQL-client-5.6.17-1.el6.i686.rpm
2、然后使用root账号登陆,进行安装:
rpm -ivh MySQL-server-5.6.17-1.el6.i686.rpm
rpm -ivh MySQL-client-5.6.17-1.el6.i686.rpm
3、启动mysql
service mysql start
4、获取root用户密码
cat /root/.mysql_secret
5、登录mysql
mysql -u root -p
1:如出现如下问题:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
2:解决方法:
vi /etc/my.cnf
增加如下信息:
[client]
socket=/var/lib/mysql/mysql.sock
3:重启mysql
service mysql restart
6、修改root密码
SET
PASSWORD=password('password'
);
7、退出重新登录mysql
8、增加mysql 远程访问的权限
GRANT
all privileges on *.* TO 'root'
@
'%'
identified by
'password'
WITH GRANT OPTION;
FLUSH PRIVILEGES;
9、重启mysql
:service mysql restart
10、进行生产服务器安全配置
/usr/bin/mysql_secure_installation
#Change the root password? 是否修改root的密码
#Enter current password for root 输入root密码
#Remove anonymous users? 是否删除匿名账号
#Remove test database and access to it? 是否删除test库和对test库的访问权限
#Reload privilege tables now? 是否现在刷新授权表使修改生效