MYSQL 安裝 for Linux
十一月 15th, 2006 瀏覽: 249人次 by smallken
* MySQL 主頁 ( 英文 ):http://www.mysql.com/
* MySQL 主頁下載:http://www.mysql.com/downloads/mysql-3.23.html
* 台灣映設站台:http://ftp.nsysu.edu.tw/Unix/Database/MySql/downloads/
--------------------------------------------------------------------------------
以下是根據官方網站的標準安裝程序
※注意事項
You may see the following error message when you run mysql_install_db:
Sorry, the host 'xxxx' could not be looked up
You can deal with this by executing mysql_install_db --force,
which does not execute the resolveip test in mysql_install_db.
The downside is that you cannot use hostnames in the grant tables:
except for localhost, you must use IP numbers instead. If you are
using an old version of MySQL that does not support --force, you must
manually remove the resolveip test in mysql_install using a text editor
意思是說,如果主機沒有domain name , 把 hostname 改成 127.0.0.1, 或者加入 --force 參數
※開始安裝
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar zxvf mysql-standard-5.0.18-linux-i686-glibc23.tar.gz -C /usr/local/
shell> cd /usr/local
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root . // pwd = /usr/local/msyql
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
開機自動啟動在 /etc/rc.local 加入
cd /usr/local/mysql; /usr/local/mysql/bin/safe_mysqld --user=mysql &
vi /etc/profile
PATH="$PATH":/usr/local/mysql/bin // 加 PATH
vi /etc/man.config
MANPATH /usr/local/mysql/man // 加入 man path
建立 mysql 的 root 密碼
方法一:
# /usr/local/mysql/bin/mysqladmin -u root password 'your.password'
# /usr/local/mysql/bin/mysql -u root -p // 登入方法
方法二:
方法一直接在shell中輸入密碼,指令會被系統記錄下來,比較不安全,安全的方法
# /usr/local/mysql/bin/mysql
>use mysql
>update user set password=password("新密碼") where user="root";
>flush privileges;
>exit;
SmallKen's Blog is power by WordPress 2.8.1