Mysql linux 安装
wget http://mysql.easynet.be/Downloads/MySQL-5.5/MySQL-server-5.5.25-1.rhel5.x86_64.rpm
Client:
wget http://mysql.easynet.be/Downloads/MySQL-5.5/MySQL-client-5.5.25-1.rhel5.x86_64.rpm
[root@inc-platform-dev-153-135 mysql]# rpm -ivh MySQL-server-4.0.16-0.i386.rpmerror: open of MySQL-server-4.0.16-0.i386.rpm failed: No such file or directory[root@inc-platform-dev-153-135 mysql]# rpm -ivh MySQL-server-5.5.25-1.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%]PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password 'new-password'/usr/bin/mysqladmin -u root -h inc-platform-dev-153-135.hst.bjc.kfc.alidc.net password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.Please report any problems with the /usr/bin/mysqlbug script!
[root@inc-platform-dev-153-135 mysql]# service mysql startStarting MySQL.. [ OK ][root@inc-platform-dev-153-135 mysql]# netstat -an|grep 3306tcp 0 0 0.0.0.0:3306 0.0.0.0:* LIST
[root@inc-platform-dev-153-135 mysql]# rpm -ivh MySQL-client-5.5.25-1.rhel5.x86_64.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%]
[root@inc-platform-dev-153-135 mysql]# /usr/bin/mysqladmin -u root password \'javaman\'
[root@inc-platform-dev-153-135 mysql]# mysql -u root -p javamanEnter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@inc-platform-dev-153-135 mysql]# service mysql stopShutting down MySQL. [ OK ][root@inc-platform-dev-153-135 mysql]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &[1] 23797[root@inc-platform-dev-153-135 mysql]# 120603 13:18:12 mysqld_safe Logging to '/var/lib/mysql/inc-platform-dev-153-135.hst.bjc.kfc.alidc.net.err'.120603 13:18:12 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql[root@inc-platform-dev-153-135 mysql]# mysql -u root mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.5.25 MySQL Community Server (GPL)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> UPDATE user SET Password=PASSWORD('javaman') where USER='root';Query OK, 4 rows affected (0.01 sec)Rows matched: 4 Changed: 4 Warnings: 0mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@inc-platform-dev-153-135 mysql]# services mysql restart
-bash: services: command not found
[root@inc-platform-dev-153-135 mysql]# service mysql restart
Shutting down MySQL.120603 13:20:26 mysqld_safe mysqld from pid file /var/lib/mysql/inc-platform-dev-153-135.hst.bjc.kfc.alidc.net.pid ended
[ OK ]
Starting MySQL.. [ OK ]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@inc-platform-dev-153-135 mysql]# mysql -uroot -pjavaman mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.5.25 MySQL Community Server (GPL)Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || test |+--------------------+4 rows in set (0.00 sec)mysql>
mysql> UPDATE user SET user='root' where host='localhost'; mysql> update user set host = '%' where user = 'root';mysql> select host, user from user;+------------------------------------------------+------+| host | user |+------------------------------------------------+------+| % | root || 127.0.0.1 | root || ::1 | root || inc-platform-dev-153-135.hst.bjc.kfc.alidc.net | || inc-platform-dev-153-135.hst.bjc.kfc.alidc.net | root || localhost | root |+------------------------------------------------+------+6 rows in set (0.00 sec)