This article is the author installs the PHP Dynamic Web server on the Linux server, the MySQL database Installation configuration Handbook. Through the server installed Apache, Mysql, PHP and other functions to achieve a dynamic PHP to create a full web site. This article is to Redhat9.0 Linux as the operating system Ping bar, Apache version is 1.3.29; database MySQL card is 3.23.58, PHP version is 4.3.4!
Linux system installation is not discussed here, this article is based on the Redhat 9.0 mini-installation plus the kernel development package is basically configured to install. For other installations with Apache,mysql and PHP and related software. Already installed, please remove the installed package with RPM-E *.
1. Install Mysql3.23.58
In fact, to be honest, directly install the MySQL official website provided by the RPM package is also a more feasible way, the RPM package on his official website is basically synchronized with the release of the TAR package, which I prefer, at least if you install the RPM package in the subsequent debugging will not appear in the MySQL library file can not find the situation. But here it is necessary to talk about the custom installation of the steps, after all, the user's custom installation also said quite a lot.
Software acquisition: www.mysql.com/downloads/index.html
Installation steps:
Tar zxvf mysql-3.23.58.tar.gz
CD mysql-3.23.58
./configure--prefix=/usr/local/mysql--sysconfdir=/etc--localstatedir=/var/lib/mysql
Make
Make install
#prefix =/usr/local/mysql mysql Installation target directory
Path to #sysconfdir =/etc my.ini configuration file
#localstatedir the path that the =/var/lib/mysql database stores
After installation to initialize the database, of course, you are upgraded without doing this step;
/usr/local/mysql/bin/mysql_install_db
If the system does not have MySQL this user, it is best to do the following step:
Useradd-m-o-r-d/var/lib/mysql-s/bin/bash-c "MySQL Server"-U-MySQL
And then I start MySQL.
/usr/local/mysql/bin/safe_mysqld &
OK, let's see if MySQL works.
Mysql-uroot MySQL
Generally, you cannot link the database properly, and the error message is generally:
ERROR 2002:can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)
In fact, everyone asked the most online is the whole problem, said what link not to mysqld.sock, in fact, we may wish to look at MySQL error log to understand how the matter, I here the error log is in
/var/lib/mysql/*.err you will find MySQL only so can not boot, because the/var/lib/mysql permission does not allow MySQL service access, English MySQL default is to invoke MySQL user to start the service, well, Now that you know what's the reason for not starting, it's easy. We just
Chown-r Mysql:mysql/var/lib/mysql on the line, if you still can not start, and then slowly debug permissions, anyway, generally can not start is the issue of permissions.
If we still can not start, then use my more cumbersome permission settings, anyway, I do it every time, generally will not have problems, see below:
Chown-r Root/usr/local/mysql
Chgrp-r Mysql/usr/local/mysql
Chown-r Root/usr/local/mysql/bin
Chgrp-r Mysql/usr/local/mysql/bin
Chgrp-r Mysql/var/lib/mysql
chmod 777/var/lib/mysql
Chown-r Root/var/lib/mysql/mysql
Chgrp-r Mysql/var/lib/mysql/mysql
chmod 777/var/lib/mysql/mysql
Chown-r root/var/lib/mysql/mysql/*
Chgrp-r mysql/var/lib/mysql/mysql/*
chmod 777/var/lib/mysql/mysql/*
chmod 777/usr/local/mysql/lib/mysql/libmysqlclient.a
Finish the steps above, and then copy a script from your catalog to the past
CP Support-files/mysql.server/etc/rc.d/init.d/mysqld
Chkconfig--add mysqld
Use the NTSYSV setting to make MySQL run automatically every time you start.
All right, now that MySQL is installed, you can start your MySQL service.
/etc/rc.d/init.d/mysqld start
The next step is more critical,
Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
Ln-s/usr/local/mysql/include/mysql/usr/include/mysql
You can not do this, you can build other software to customize the MYSLQ of the library file path, but I still like to link the library file to the default location, so you can compile similar software such as Php,vpopmail without specifying MySQL's library file address.