2010-03-17

於 Ubuntu 手動安裝 MySQL Database (Manuel install the MySQL Database in Ubuntu)

前往 http://www.mysql.com/
Visit http://www.mysql.com/

點擊 Downloads (GA) > MySQL Server
選擇 Linux - Generic 按 Select
Click Downloads (GA) > MySQL Server
Select Linux - Generic 按 Select

按 mysql-5.1.44-linux-i686-glibc23.tar.gz 的 Download 後註冊下載 (暫時儲存至 Desktop 位置方便尋找)
(5.1.44 是 2010-03-17 最新版本)
(mysql-5.1.44-linux-i686-glibc-23 是免編譯版本)
(mysql-5.1.44 則需要編譯,需要某些額外元件才能安裝,比較複雜)
(若不想註冊亦可以利 Google 等搜尋器尋找其他下載點)
Click mysql-5.1.44-linux-i686-glibc23.tar.gz then register and download it (Save at Desktop for easy find)
(5.1.44 is the latest version on 2010-03-17)
(mysql-5.1.44-linux-i686-glibc-23 is a non-compile version)
(mysql-5.1.44 is a compile version, it needs other components to install with, a little bit complex)
(If you don't want to register, you can search with Google to download another file)

下載 .tar.gz 檔案後開啟 Terminal
輸入以下指令
After download the .tar.gz file then open the Terminal
Enter the command below

cd "/home/abc/Desktop"
abc 是使用者登入名稱
abc is the user login name

tar -zxvf "./mysql-5.1.44-linux-i686-glibc23.tar.gz"
將 .tar.gz 檔案解壓縮
Unzip the .tar.gz

sudo mv "mysql-5.1.44-linux-i686-glibc23" "/usr/local/mysql"
第一次使用 sudo 後需要輸入使用者登入密碼
將 MySQL 整個目錄移動至 /usr/local/mysql (建議)
You need to enter the password when you use sudo
Move mysql-5.1.44-linux-i686-glibc23 to /usr/local/musql/ directory (Recommended)

cd "/usr/local/mysql"
進入 mysql 的目錄
change directory to mysql directory

"./scripts/mysql_install_db"
設置 mysql 的設定資料庫
Setup up the mysql database

/usr/local/mysql/support-files/mysql.server start
起動 MySQL Database
Start the MySQL Database

有需要的話可以輸入以下指令
If you need you can enter this command

sudo cp "/usr/local/mysql/support-files/mysql.server" "/etc/init.d/mysqld"
這樣便可以透過
This can be through

service mysqld start
來起動 MySQL Database 不用記著太長的檔案路徑
Start the MySQL Database and don't need to type a long path

(將 start 改為 stop 則是終止運作)
(change start to stop to stop the server)

netstat -atln
看到 port 3306 被使用
You can see port 3306 has been used

/usr/local/mysql/bin/mysql -u root -p

or
/usr/local/mysql/bin/mysql
前者為以 MySQL 的 root 身份登入 MySQL, 由於未設定密碼, 當要求輸入登入密碼時不用輸入任何文字, 直接按下 Enter 鍵便可登入
後者為以一般使用者登入 MySQL
The first one is using the root account of MySQL to login MySQL, but the password does not setup yet, so you don't need the enter any password, just click enter to login
The next one is using a normal user to login MySQL

提外話, 輸入 sudo gedit /etc/bash.bashrc
開啟 gedit 後在文件最尾的位置輸入
export PATH=${PATH}:/usr/local/mysql/bin
便可以直接輸入 mysql 指令來登入 MySQL
Enter sudo gedit /etc/bash.bashrc
open gedit and scroll to the end of file and type
export PATH=${PATH}:/usr/local/mysql/bin
It can just use mysql to login MySQL

若能夠在 Terminal 指令列顯示 mysql> 表示設定完成 MySQL Database 可以運作
若不能夠願顯示則未設定好完成請重新確認設定資料,有需要時由頭重新設定
After setup use Terminal with MySQL commands and shows mysql> that means MySQL Database is running
If can't, check the config file, or you need to re-install the Server

沒有留言 :

張貼留言