MYSQL服務安裝總結
系統環境信息 www.2cto.com
CentOS release 6.3 (Final)
VMware® Workstation 9.0.0 build-812388
rpm安裝包准備
1 從光盤拷貝如下安裝包到指定目錄
2 也可以從RPM資源網站下載到本地環境
http://rpmfind.net/linux/
perl-DBI-1.609-4.el6.i686.rpm
mysql-libs-5.1.61-4.el6.i686.rpm
mysql-5.1.61-4.el6.i686.rpm
perl-DBD-MySQL-4.013-3.el6.i686.rpm
mysql-server-5.1.61-4.el6.i686.rpm
目錄名稱
/usr/dev/mysql
卸除原有MYSQL服務
參見MYSQL服務卸除文章
http://www.BkJia.com/database/201211/165448.html
操作步驟
#cd /usr/dev
#rpm -ivh perl-DBI-1.609-4.el6.i686.rpm
#rpm -ivh mysql-libs-5.1.61-4.el6.i686.rpm
#rpm -ivh mysql-5.1.61-4.el6.i686.rpm
#rpm -ivh perl-DBD-MySQL-4.013-3.el6.i686.rpm
#rpm -ivh mysql-server-5.1.61-4.el6.i686.rpm
#/usr/bin/mysql_install_db --user=mysql
#/usr/bin/mysqld_safe &
#/etc/init.d/mysqld status
備注
命令7含義 初始化MYSQL數據庫 該命令用來初始化 mysql數據庫,即創建/var/lib/mysql目錄
命令8含義 啟動MYSQL服務
命令9含義 查看MYSQL啟動狀態
執行命令7後顯示如下信息
========================================================
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 localhost.localdomain 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!
================================================
執行命令8後顯示如下信息
================================================
mysqld_safe Logging to '/var/log/mysqld.log'.
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
================================================
執行命令9後顯示如下信息
================================================
mysqld (pid 4200) is running...
================================================