1. 下載"MySQL-standard-5.0.27-Linux-i686-icc-glibc23.tar.gz",推薦ICC版本,據稱比GCC性能提高10-20%
2. 復制到/usr/local/,解壓:tar zxvf MySQL-standard-5.x....tar.gz
3. 添加用戶和組MySQL:
groupadd MySQL
useradd -g mysql MySQL
4. 創建符號連接:/usr/local # ln -s mysql-standard-5.x... MySQL
5. cd mysql,當前目錄改為/usr/local/MySQL/
6. 運行腳步初始化數據庫:./scripts/mysql_install_db --user=MySQL
7. 設置權限:
/usr/local/MySQL # chown -R root .
/usr/local/mysql # chown -R MySQL data
/usr/local/mysql # chgrp -R MySQL
8. 根據需要創建並修改/etc/my.cnf,參考配置:
[MySQLd]
# 設置默認為INNODB表,支持事務:
default-storage-engine=INNODB
# 設置默認的字符集:
default-character-set=utf8
# 禁用bdb:
http://www.knowsky.com
skip-bdb
9. 啟動MySQL:
/usr/local/mysql/bin # ./mysqld_safe --user=MySQL &
10. 初始化root口令:
/usr/local/mysql/bin # ./MySQLadmin -u root -p password "passWord-of-root"
Enter passWord: <輸入舊口令,直接按Enter>
11. 以root登錄創建數據庫:
/usr/local/mysql # ./MySQL -u root -p
Enter password: passWord-of-root
創建一個新用戶:
MySQL> create user test identifIEd by 'test-passWord';
創建一個新數據庫:
MySQL> create database testdb;
賦予test用戶從localhost訪問testdb的權限:
MySQL> grant all on testdb.* to test@localhost;
停止MySQL服務器:
/usr/local/mysql/bin # ./MySQLadmin -u root -p shutdown
Enter password: passWord-of-root
STOPPING server from pid file /usr/local/MySQL/data/debian.pid
xxx MySQLd ended