一、安裝項目

mysql.x86_64 : MySQL client programs and shared libraries
mysql-server.x86_64 : The MySQL server and related files
mysql-devel.x86_64 : Files for development of MySQL applications
php-mysql.x86_64 : A module for PHP applications that use MySQL databases

 

二、執行安裝

yum install mysql mysql-server mysql-devel php-mysql

三、啟動mySQL

[root@dns conf]# service mysqld start
正在初始化 MySQL 資料庫: Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

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 ns1.localhost 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.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

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

                                                                            [  確定  ]
正在啟動 mysqld:                                          [  確定  ]

四、更改root密碼

/usr/bin/mysqladmin -u root password '你的密碼'

五、驗證登入

    [root@dns ~]# mysql -h localhost -u root -p
    Enter password:

 

 

h為要登入的主機名稱,可省略,未指定就是本機
-u為使用者名稱,可省略,未指定就是下指令的user
-p為密碼,如果有設密碼的話就不能省略。密碼不用先輸入,按下確定後系統會請你輸入密碼,如範例第二行
-h, -u和-p選項的另一種形式是--host=host_name、--user=user_name和--password=your_pass。注意在-p或--password=與跟隨它後面的口令之間沒有空格。

arrow
arrow
    文章標籤
    CENTOS mySQL
    全站熱搜
    創作者介紹
    創作者 K 的頭像
    K

    K'隨手記

    K 發表在 痞客邦 留言(0) 人氣()