分类:
2005-08-06 11:28:13
============================
2.1 安装mysql
[mailsrv:/home/davidji/softs]# gunzip mysql-3.23.53-sol9-sparc-local.gz
[mailsrv:/home/davidji/softs]# pkgadd -d mysql-3.23.53-sol9-sparc-local
The following packages are available:
1 SMCmysql mysql
(sparc) 3.23.53
/usr/local/mysql/sql-bench/test-select
/usr/local/mysql/sql-bench/test-wisconsin
[ verifying class
Installation of
============================
2.2 安装mysql数据库
[mailsrv:/home/davidji/softs]# cd /usr/local/mysql
[mailsrv:/usr/local/mysql]# 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
050806 10:40:26 /usr/local/mysql/libexec/mysqld: Shutdown Complete
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h mailsrv password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/safe_mysqld &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; run-all-tests
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
The latest information about MySQL is available on the web at
Support MySQL by buying support/licenses at
[mailsrv:/usr/local/mysql]# ll
total 26
drwxr-xr-x 13 root other 512 Aug 6 10:40 ./
drwxr-xr-x 3 root other 512 Aug 6 10:38 ../
drwxr-xr-x 2 bin bin 1024 Aug 6 10:38 bin/
drwxr-xr-x 3 bin bin 512 Aug 6 10:38 doc/
drwxr-xr-x 3 bin bin 512 Aug 6 10:38 include/
drwxr-xr-x 2 bin bin 512 Aug 6 10:38 info/
drwxr-xr-x 3 bin bin 512 Aug 6 10:38 lib/
drwxr-xr-x 2 bin bin 512 Aug 6 10:38 libexec/
drwxr-xr-x 3 bin bin 512 Aug 6 10:38 man/
drwxr-xr-x 6 bin bin 512 Aug 6 10:38 mysql-test/
drwxr-xr-x 3 bin bin 512 Aug 6 10:38 share/
drwxr-xr-x 7 bin bin 1024 Aug 6 10:38 sql-bench/
drwx------ 4 root other 512 Aug 6 10:40 var/
可见,系统自己新建了一个var目录,用来存放数据库;
[mailsrv:/usr/local/mysql]# ls var
./ ../ mysql/ test/
============================
2.3 启动 mysqld 服务进程
[mailsrv:/usr/local/mysql]# safe_mysqld &
[1] 550
[mailsrv:/usr/local/mysql]# chown: unknown user id mysql
Starting mysqld daemon with databases from /usr/local/mysql/var
050806 10:42:35 mysqld ended
[1]+ Done safe_mysqld
上面的错误提示是,没有创建mysql的用户。
[mailsrv:/usr/local/mysql]# groupadd mysql
[mailsrv:/usr/local/mysql]# useradd -g mysql -d /usr/local/mysql -m mysql
[mailsrv:/usr/local/mysql]# safe_mysqld &
[1] 577
[mailsrv:/usr/local/mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
050806 10:43:58 mysqld ended
[1]+ Done safe_mysqld
[mailsrv:/usr/local/mysql]#
[mailsrv:/usr/local/mysql]# cat var/mailsrv.err
050806 10:42:35 mysqld started
Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
050806 10:42:35 Aborting
050806 10:42:35 /usr/local/mysql/libexec/mysqld: Shutdown Complete
050806 10:42:35 mysqld ended
050806 10:43:58 mysqld started
050806 10:43:58 /usr/local/mysql/libexec/mysqld: Can't create/write to file '/usr/local/mysql/var/mailsrv.pid' (Errcode: 13)
050806 10:43:58 /usr/local/mysql/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
050806 10:43:58 /usr/local/mysql/libexec/mysqld: Error on delete of '/usr/local/mysql/var/mailsrv.pid' (Errcode: 13)
050806 10:43:58 mysqld ended
检查错误日志, 发现mysql不能写var目录;
[mailsrv:/usr/local/mysql]# chown -R mysql /usr/local/mysql
[mailsrv:/usr/local/mysql]# safe_mysqld &
[1] 603
[mailsrv:/usr/local/mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
[mailsrv:/usr/local/mysql]# prstat
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
621 root 4584K 4352K cpu0 59 0 0:00:00 0.1% prstat/1
235 root 2904K 2232K sleep 59 0 0:00:00 0.1% nscd/18
616 mysql 12M 3032K sleep 59 0 0:00:00 0.0% mysqld/2 看这里,mysqld已经运行啦!
387 root 4008K 2096K sleep 59 0 0:00:00 0.0% sdt_shell/1
402 root 4648K 3464K sleep 59 0 0:00:00 0.0% ttsession/1
357 root 2600K 1032K sleep 59 -10 0:00:00 0.0% speckeysd/1
403 root 8448K 6248K sleep 49 0 0:00:00 0.0% dtsession/2
338 smmsp 4312K 1448K sleep 59 0 0:00:00 0.0% sendmail/1
339 root 4352K 1928K sleep 59 0 0:00:00 0.0% sendmail/1
325 root 2376K 1288K sleep 59 0 0:00:00 0.0% fbconsole/1
320 root 5000K 2120K sleep 59 0 0:00:00 0.0% dtlogin/1
318 root 2728K 1448K sleep 59 0 0:00:00 0.0% sshd/1
314 root 1784K 1112K sleep 59 0 0:00:00 0.0% ttymon/1
324 root 6840K 3208K sleep 59 0 0:00:00 0.0% dtlogin/1
345 root 1920K 1312K sleep 59 0 0:00:00 0.0% Xsession/1
323 root 19M 11M sleep 59 0 0:00:01 0.0% Xsun/1
271 root 2632K 2056K sleep 59 0 0:00:01 0.0% vold/2
267 root 1728K 1120K sleep 59 0 0:00:00 0.0% smcboot/1
257 root 1040K 688K sleep 59 0 0:00:00 0.0% utmpd/1
270 root 1728K 744K sleep 59 0 0:00:00 0.0% smcboot/1
214 root 3328K 1744K sleep 59 0 0:00:00 0.0% syslogd/12
197 daemon 2464K 1776K sleep 59 0 0:00:00 0.0% statd/1
194 root 2184K 1464K sleep 59 0 0:00:00 0.0% lockd/2
203 root 4072K 2592K sleep 59 0 0:00:00 0.0% automountd/3
268 root 1728K 744K sleep 59 0 0:00:00 0.0% smcboot/1
407 root 8848K 6848K sleep 49 0 0:00:00 0.0% dtfile/1
231 root 2288K 1232K sleep 59 0 0:00:00 0.0% cron/1
246 root 1408K 1088K sleep 59 0 0:00:00 0.0% powerd/3
179 root 2432K 1800K sleep 59 0 0:00:00 0.0% inetd/1
126 root 4760K 2496K sleep 59 0 0:00:00 0.0% skipd/1
141 root 2176K 1248K sleep 59 0 0:00:00 0.0% rpcbind/1
64 root 2640K 1816K sleep 59 0 0:00:00 0.0% picld/4
52 root 2296K 1432K sleep 59 0 0:00:00 0.0% syseventd/13
353 root 2376K 1392K sleep 59 0 0:00:00 0.0% fbconsole/1
316 root 1784K 1160K sleep 59 0 0:00:00 0.0% ttymon/1
Total: 56 processes, 111 lwps, load averages: 0.00, 0.04, 0.09
============================
2.4 测试 mysql client 程序:
[mailsrv:/usr/local/mysql]# mysql
ld.so.1: mysql: fatal: libncurses.so.5: open failed: No such file or directory
Killed
[mailsrv:/]# cd /home/davidji/softs/
[mailsrv:/home/davidji/softs]# gunzip ncurses-5.3-sol9-sparc-local.gz
[mailsrv:/home/davidji/softs]# pkgadd -d ncurses-5.3-sol9-sparc-local
The following packages are available:
1 SMCncurs ncurses
(sparc) 5.3
/usr/local/share/terminfo/z/ztx11
Installation of
[mailsrv:/home/davidji/softs]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1 to server version: 3.23.53
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
看到了吧。mysql client也好用啦!
============================
2.5 把mysqld 配置成开机自启动服务:
# cp /usr/local/mysql/share/mysql.server /etc/init.d/mysqld
# cp /usr/local/mysql/share/my-medium.cnf /etc/my.cnf
# ln -s /etc/init.d/mysqld /etc/rc3.d/S90mysqld
# ln -s /etc/init.d/mysqld /etc/rc2.d/K90mysqld
# ln -s /etc/init.d/mysqld /etc/rc0.d/K90mysqld
# reboot
启动后,经过测试,mysql一切正常,至此,MYSQL安装完毕。
_________________
※※※※※※※※※※※※※※※※※※※※
携手同行