日期:2014-05-16  浏览次数:20722 次

RHE5 -- 安装Mysql5
下载下来:
-rw-r--r-- 1 root root  7635229 Jul 30 07:38 MySQL-client-community-5.1.49-1.rhel5.i386.rpm
-rw-r--r-- 1 root root 21277185 Jul 30 07:38 MySQL-server-community-5.1.49-1.rhel5.i386.rpm

动工了:
[root@localhost software]# rpm -ivh MySQL-server-community-5.1.49-1.rhel5.i386.rpm

[root@localhost software]# rpm -ivh MySQL-client-community-5.1.49-1.rhel5.i386.rpm

启动:
[root@localhost software]# /etc/init.d/mysql start
Starting MySQL                                             [  OK  ]

重启:
[root@localhost software]# /etc/init.d/mysql restart
Shutting down MySQL....                                    [  OK  ]
Starting MySQL.                                            [  OK  ]

关掉:
[root@localhost software]# /usr/bin/mysqladmin -u root -p shutdown
Enter password:

登录授权:
[root@localhost software]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.49-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'lake'@'%'IDENTIFIED BY 'lake' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@localhost software]# mysql -ulake -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.49-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

远程登录(再执行一次授权):
mysql> GRANT ALL PRIVILEGES ON *.* TO 'lake'@'%'IDENTIFIED BY 'lake' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> Ctrl-C -- exit!
[root@localhost software]# mysql -u lake -h 192.168.116.129 -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.49-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

开放端口:
[root@localhost software]# vim /etc/sysconfig/iptable
有没有看到:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
这就是开放22端口
意思意思:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j