1. 程式人生 > >linux下MySQL安裝(rpm)

linux下MySQL安裝(rpm)

1,根據伺服器情況下載server rpm和client rpm 下載地址http://dev.mysql.com/downloads/mysql/5.1.html

2,linux下執行rpm -ivh MySQL-server-community-5.1.58-1.rhel5.x86_64.rpm

Preparing... ########################################### [100%]
1:MySQL-server-community ########################################### [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 tc_132_16 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!


Starting MySQL.[ OK ]
Giving mysqld 2 seconds to start

netstat -nat

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

mysql服務已經啟動

3 ,安裝客戶端,執行rpm -ivh MySQL-client-community-5.1.58-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client-community ########################################### [100%]

執行mysql

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.58-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>

安裝成功

4, 預設mysql安裝完成後是沒有密碼的,

執行usr/bin/mysqladmin -u root password 'newpassword'

修改密碼

連線mysql -uroot -pnewpassword

成功

安裝mysql完成

重啟mysql可以通過service mysqld restart完成