程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> 新手一步一步教你在Linux下安裝MySQL

新手一步一步教你在Linux下安裝MySQL

編輯:MySQL綜合教程

     終於成功地在linux上面裝上mysql了。興奮之余寫了這篇東西來紀念一下,順便做個筆記,以便以後遇到問題時可以查閱。

首先看看安裝需要用到的所有的包吧。

[root@localhost6 mysql]# ls

mysql-5.0.37-2.fc7.i386.rpm mysql-server-5.0.37-2.fc7.i386.rpm unixODBC-2.2.12-2.fc7.i386.rpm

mysql-connector-odbc-3.51.12-2.2.i386.rpm perl-DBD-MySQL-3.0008-1.fc7.i386.rpm

mysql-libs-5.0.37-2.fc7.i386.rpm perl-DBI-1.53-2.fc7.i386.rpm

         接下來就是安裝數據庫的過程了。因為各個包都存在著一定的依賴關系的,所以大家在安裝時最好按照我的安裝順序來安裝,雖然我不敢說這個是唯一正確的順序,但是至少是可行的一個按照順序。

[root@localhost6 mysql]# rpm -ivh perl-DBI-1.53-2.fc7.i386.rpm

warning: perl-DBI-1.53-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:perl-DBI ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh perl-DBD-MySQL-3.0008-1.fc7.i386.rpm

warning: perl-DBD-MySQL-3.0008-1.fc7.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:perl-DBD-MySQL ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-libs-5.0.37-2.fc7.i386.rpm

warning: mysql-libs-5.0.37-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:mysql-libs ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-5.0.37-2.fc7.i386.rpm

warning: mysql-5.0.37-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:mysql ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-server-5.0.37-2.fc7.i386.rpm

warning: mysql-server-5.0.37-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:mysql-server ########################################### [100%]

        到此為止,整個mysql已經安裝完成了。接下來是啟動mysql的守護進程。過程大致如下

[root@localhost6 mysql]# chown -R mysql:mysql /var/lib/mysql

[root@localhost6 mysql]# /etc/init.d/mysqld start

初始化 MySQL 數據庫: Installing all prepared tables

Fill help tables

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 localhost6.localdomain6 password 'new-password'

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 the benchmarks in the 'sql-bench' directory:

cd sql-bench ; perl run-all-tests

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

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

[確定]

啟動 MySQL[確定]

        當你見到上面這個頁面時,恭喜你,你安裝成功了。現在你只要在終端輸入mysql就可以使用了。我們來試試啟動mysql來看看。

[root@localhost6 mysql]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.0.37 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

成功啟動了。

mysql> quit;

Bye

退出成功。

        但是一般情況下要進行開發必然要用其他語言來連接mysql的,所以肯定要裝odbc。安裝過程如下。

[root@localhost6 mysql]# rpm -ivh unixODBC-2.2.12-2.fc7.i386.rpm

warning: unixODBC-2.2.12-2.fc7.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:unixODBC ########################################### [100%]

[root@localhost6 mysql]# rpm -ivh mysql-connector-odbc-3.51.12-2.2.i386.rpm

warning: mysql-connector-odbc-3.51.12-2.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2

Preparing... ########################################### [100%]

1:mysql-connector-odbc ########################################### [100%]

         odbc也安裝成功。現在你就可以使用了mysql來進行開發了。至於怎麼設置和使用,那就要看你自己對mysql的掌握程度了,我不在這獻丑了。希望這篇文章能夠幫助到其他和我一樣的菜鳥吧。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved