一、安裝
本次安裝在root用戶下進行
#gunzip MySQL-5.0.90-solaris10-x86_64.tar.gz
# cd /usr/local
# tar -xvf /userdata/software/MySQL-5.0.90-solaris10-x86_64.tar
# ls -ld MySQL*
# ln -s mysql-5.0.90-solaris10-x86_64 MySQL
# ls -ld MySQL*
# cd MySQL-5.0.90-solaris10-x86_64
# ./configure
二、啟動MySQLd服務
# cp /usr/sfw/share/MySQL/my-medium.cnf /etc/my.cnf
# vi /etc/my.cnf
[MySQLd]
datadir=/usr/local/MySQL/data
socket=/tmp/MySQL.sock
[MySQL.server]
user=MySQL
basedir=/usr/local/MySQL
[clIEnt]
socket=/tmp/MySQL.sock
# /usr/local/mysql/bin/MySQLd_safe &
6914
# Starting mysqld daemon with databases from /usr/local/MySQL/data
三、設置密碼
#./MySQLadmin -u root passWord 'imc168'
四、創建數據庫
# ./MySQL -u root -p
Enter passWord:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.90 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL> create database jtrac;
Query OK, 1 row affected (0.02 sec)
MySQL> use jtrac;
Database changed
MySQL> show tables;
Empty set (0.00 sec)
五、恢復數據
MySQL> source /userdata/backup20100607.sql
MySQL> show tables;
MySQL> exit
六、修改root密碼的方法
# ./MySQL -u root -p
Enter passWord:
mysql> use MySQL;
MySQL> UPDATE user SET Password=PASSWord('imc@3*it') where USER='root';
MySQL> FLUSH PRIVILEGES;
MySQL> exit
七、啟用遠程登錄
給指定的數據庫用戶打開遠程訪問權限
grant all privileges on *.* to 'jtrac'@'109.14.6.230' identifIEd by 'jtrac' WITH GRANT OPTION;
以上命令是允許用戶jtrac從ip為109.14.6.230的主機連接到MySQL服務器,並使用jtrac作為密碼
八、關閉MySQL
MySQLadmin -u root --passWord=imc@3*it shutdown
九、字符集設置
在[clIEnt] 和[MySQLd]下面分別加入:default_character_set=utf8
MySQL> SHOW VARIABLES LIKE 'character%';
+--------------------------+----------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------------------------------------+
| character_set_clIEnt | gbk |
| character_set_connection | gbk |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.0.90-solaris10-x86_64/share/MySQL/charsets/ |
+--------------------------+----------------------------------------------------------------+