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

Mysql linux 安装
引用
Redhat 5 下安装Mysql


1.下载Server和client
Server:
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


2.安装server和client

安装Server
[root@inc-platform-dev-153-135 mysql]#  rpm -ivh MySQL-server-4.0.16-0.i386.rpm
error: 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_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!


启动Server
[root@inc-platform-dev-153-135 mysql]# service mysql start
Starting MySQL..                                           [  OK  ]
[root@inc-platform-dev-153-135 mysql]# netstat -an|grep 3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LIST

安装Client
[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%]


3.修改mysql的root用户密码
[root@inc-platform-dev-153-135 mysql]# /usr/bin/mysqladmin -u root password \'javaman\' 

3.登录MySql
登录:
[root@inc-platform-dev-153-135 mysql]# mysql -u root -p javaman
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

无法登录要修改配置:
[root@inc-platform-dev-153-135 mysql]# service mysql stop
Shutting 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 mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server 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 its
affiliates. Other names may be trademarks of their respective
owners.

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: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@inc-platfor