1,以root用戶登錄系統並初始化數據庫表:
# /usr/sfw/bin/mysql_install_db
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
060118 21:24:03 /usr/sfw/sbin/mysqld: Shutdown Complete
2.創建mysql用戶和組:
# groupadd mysql
# useradd -g mysql mysql
# chgrp -R mysql /var/mysql
# chmod -R 770 /var/mysql
# installf SUNWmysqlr /var/mysql d 770 root mysql
3.mysql的配置文件:
Filename Purpose
--------- ---------
defaults-extra-file The file specified with --defaults-extra-file=path
4.創建配置文件:
在solaris中默認的DATADIR是/var/mysql
5.以後台方式啟動mysql服務器:
# /usr/sfw/sbin/mysqld_safe --user=mysql &
6.設置mysql用戶root的密碼:
# cd /usr/sfw/bin
# ./mysqladmin -u root password 'new-password'
# ./mysqladmin -u root -h `hostname` password 'new-password'
7.測試數據庫服務器:
# ./mysqlshow -p
Enter password: new-password
+-----------+
| Databases |
+-----------+
| mysql |
| test |
+-----------+
# ./mysql -u root -p
Enter password: new-password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.20-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+-----------+
| Databases |
+-----------+
| mysql |
| test |
+-----------+
2 rows in set (0.00 sec)
mysql> quit;
Bye
8.當系統重啟時使mysql服務自動啟動:
配置完畢。