Linux+nginx+MySQL+cacti网站服务器的搭建(1)

(一) 安装MySQL

这里主要针对的是CentOS系统。

[cce]
[root@demeter data]# wget -c http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.10-1.rhel5.i386.tar/from/http://mysql.ntu.edu.tw/
[root@demeter data]# ls -al
drwxr-xr-x 5 root root       4096 Mar 25 18:09 .
drwxr-x--- 6 root root       4096 Mar 25 18:39 ..
-rw-r--r-- 1 root root  168099840 Mar 10 07:40 MySQL-5.5.10-1.rhel5.i386.tar
[root@demeter data]# tar xvf MySQL-5.5.10-1.rhel5.i386.tar
[root@demeter data]# ls -al
-rw-r--r-- 1 root root  168099840 Mar 10 07:40 MySQL-5.5.10-1.rhel5.i386.tar
-rw-r--r-- 1 7161 wheel  17976551 Mar  9 23:44 MySQL-client-5.5.10-1.rhel5.i386.rpm
-rw-r--r-- 1 7161 wheel   3564435 Mar  9 23:45 MySQL-devel-5.5.10-1.rhel5.i386.rpm
-rw-r--r-- 1 7161 wheel  48689616 Mar  9 23:47 MySQL-embedded-5.5.10-1.rhel5.i386.rpm
-rw-r--r-- 1 7161 wheel  53260513 Mar  9 23:44 MySQL-server-5.5.10-1.rhel5.i386.rpm
-rw-r--r-- 1 7161 wheel   2024798 Mar  9 23:45 MySQL-shared-5.5.10-1.rhel5.i386.rpm
-rw-r--r-- 1 7161 wheel  42578261 Mar  9 23:45 MySQL-test-5.5.10-1.rhel5.i386.rpm
[root@demeter data]# rpm –Uvh MySQL-client-5.5.10-1.rhel5.i386.rpm MySQL-server-5.5.10-1.rhel5.i386.rpm MySQL-shared-5.5.10-1.rhel5.i386.rpm MySQL-devel-5.5.10-1.rhel5.i386.rpm MySQL-test-5.5.10-1.rhel5.i386.rpm MySQL-embedded-5.5.10-1.rhel5.i386.rpm
[root@demeter data]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
[root@demeter mysql]# mysql_install_db --user=mysql --datadir=/var/lib/mysql/
[/cce]
原因是重装的时候数据目录不一致导致

然后再次启动,OK

[cce]
mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
^G/usr/sbin/mysqld: File './mysql-bin.index' not found
[root@demeter data]# chown –R mysql:mysql /var/lib/mysql
[root@demeter date]# cd /var/lib/mysql
[root@demeter mysql]# ls -al
-rw-rw----  1 mysql mysql     9706 Mar 25 21:05 demeter.smm.cn.err
-rw-rw----  1 mysql mysql        6 Mar 25 21:04 demeter.smm.cn.pid
-rw-rw----  1 mysql mysql 18874368 Mar 25 20:44 ibdata1
-rw-rw----  1 mysql mysql  5242880 Mar 25 21:04 ib_logfile0
-rw-rw----  1 mysql mysql  5242880 Mar 25 20:42 ib_logfile1
drwx------  2 mysql mysql     4096 Mar 25 21:03 mysql
-rw-rw----  1 mysql mysql      126 Mar 25 20:44 mysql-bin.000001
-rw-rw----  1 mysql mysql      107 Mar 25 20:46 mysql-bin.000002
-rw-rw----  1 mysql mysql    27829 Mar 25 21:03 mysql-bin.000003
-rw-rw----  1 mysql mysql   995332 Mar 25 21:03 mysql-bin.000004
-rw-rw----  1 mysql mysql      107 Mar 25 21:04 mysql-bin.000005
-rw-rw----  1 mysql mysql       95 Mar 25 21:04 mysql-bin.index
srwxrwxrwx  1 mysql mysql        0 Mar 25 21:04 mysql.sock
drwx------  2 mysql mysql     4096 Mar 25 21:03 performance_schema
drwx------  2 mysql mysql     4096 Mar 25 16:17 test
[/cce]

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注