[三]安裝mysql 5.0
# cd /home/myhome/software/
# tar zvxf mysql-5.0.45-linux-i686-glibc23.tar.gz
# mkdir -p /usr/local/mysql (省略也可)
# cp -r mysql-5.0.45-linux-i686-glibc23/* /usr/local/mysql/
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
# chmod 600 /etc/my.cnf

新增 mysql  USER與GROUP
# groupadd mysql
# useradd -g mysql mysql

修改mysql目錄權限
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# scripts/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql data
# /usr/local/mysql/bin/mysqld_safe --user=mysql &


如出現 Starting mysqld daemon with databases from /usr/local/mysql/data 代表正常啟動mysql服務了,
按Ctrl + C 跳出修改 mysql 的 root 密碼
# /usr/local/mysql/bin/mysqladmin -u root password 'MyPasswd'


--以後的 開關方式:
啟動:
/usr/local/mysql/support-files/mysql.server start

關閉:
/usr/local/mysql/support-files/mysql.server stop


簡易的小教學:
# /usr/local/mysql/bin/mysql -u root -p

看資料庫:
show databases;

使用資料庫:
use mysql;

看資料表:
show tables;

更新密碼 與 權限刷新 應該這樣說吧XD:
UPDATE user SET password = password('MyPasswd') WHERE user ='root';
FLUSH PRIVILEGES;

受權localhost
GRANT all privileges
on *.*
to root@localhost
identified by 'MySetPasswd';

受權其他IP
GRANT all privileges
on *.*
to root@192.168.1.123
identified by 'MySetPasswd';

hsinichi 發表在 痞客邦 PIXNET 留言(0) 人氣()