一、上传
MYSQL安装包到root目录下,并用rpm -ivh 安装
MySQL-client-5.6.13-1.rhel5.x86_64.rpm
MySQL-server-5.6.13-1.rhel5.x86_64.rpm
二、执行如下命令:
a)查询初始默认登录密码:
[root@localhost ~]# cat /root/.mysql_secret
# The random password set for the root user at Wed Jul 30 23:37:28 2014 (local time): yeZZz4e8
b)启动MYSQL:
/etc/init.d/mysql start
c)登陆 数据库并修改密码:
[root@localhost ~]# mysql -u root -p
Enter password: yeZZz4e8
----------------------------------------------------------------
mysql> SET PASSWORD = PASSWORD('123456'); --修改密码
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
d)设置远程连接配置
[root@localhost ~]# mysql -u root -p
Enter password: 123456
mysql> use mysql; --连接数据库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set host='%' where user='root' and host='localhost'; --设置任何主机都可以连接此数据库
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> exit
Bye
f)重启MYSQL就可以远程客户端工具连接使用了;
/etc/init.d/mysql restart
FAQ1:有时会出现安装完成,客户端连接不上 server的情况;关闭防火墙即可
[root@localhost init.d]# /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
MySQL-client-5.6.13-1.rhel5.x86_64.rpm
MySQL-server-5.6.13-1.rhel5.x86_64.rpm
二、执行如下命令:
a)查询初始默认登录密码:
[root@localhost ~]# cat /root/.mysql_secret
# The random password set for the root user at Wed Jul 30 23:37:28 2014 (local time): yeZZz4e8
b)启动MYSQL:
/etc/init.d/mysql start
c)登陆 数据库并修改密码:
[root@localhost ~]# mysql -u root -p
Enter password: yeZZz4e8
----------------------------------------------------------------
mysql> SET PASSWORD = PASSWORD('123456'); --修改密码
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
d)设置远程连接配置
[root@localhost ~]# mysql -u root -p
Enter password: 123456
mysql> use mysql; --连接数据库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set host='%' where user='root' and host='localhost'; --设置任何主机都可以连接此数据库
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> exit
Bye
f)重启MYSQL就可以远程客户端工具连接使用了;
/etc/init.d/mysql restart
FAQ1:有时会出现安装完成,客户端连接不上 server的情况;关闭防火墙即可
[root@localhost init.d]# /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]