Debugging environment: Redhat9.0Apache1.3.29Mysql3.23.58PHP4.3.4
I won’t go into the installation of the Linux system. This is a basic skill. In fact, this article should also be applicable to other Linux systems like Redhat. You only need to master the method I provided. Remember not to install the system default apache, mysql, php and related software when installing Redhat9.0. If it is already installed, please use rpm-e* to delete the installed package.
1.Install Mysql3.23.58
In fact, to be honest, it is a more feasible way to directly install the rpm package provided by the Mysql official website. The rpm package provided by its official website is basically synchronized with the release of the tar package. I like this better. At least the installation of the rpm package is at the back. The mysql library file will not be found during debugging. But it is still necessary to talk about the steps of custom installation here. After all, there are quite a lot of custom installations by netizens.
Software acquisition: http://www.mysql.com/downloads/index.html
Installation steps:
tarzxvfmysql-3.23.58.tar.gz
cdmysql-3.23.58
./configure--prefix=/usr/local/mysql--sysconfdir=/etc--localstatedir=/var/lib/mysql
make
makeinstall
#prefix=/usr/local/mysqlm The target directory for mysql installation
#sysconfdir=/etcmy.ini configuration file path
#localstatedir=/var/lib/mysql database storage path
After installation, you need to initialize the database. Of course, you don’t need to do this step if you are upgrading;
/usr/local/mysql/bin/mysql_install_db
If the system does not have the mysql user, it is best to do the following steps:
useradd-Mord/var/lib/mysql-s/bin/bash-c"MySQLServer"-u27mysql
Then I start mysql
/usr/local/mysql/bin/safe_mysqld&
ok, first see if mysql can work normally
mysql-urootmysql
Under normal circumstances, the database cannot be connected normally, and the error message is usually:
ERROR2002:Can'tconnecttolocalMySQLserverthroughsocket'/var/lib/mysql/mysql.sock'(2)
In fact, the most frequently asked question on the Internet is the whole question, saying that mysqld.sock cannot be linked. In fact, you might as well look at the error log of mysql to understand what is going on. My error log here is in /var/lib/mysql/ *.err, you will find that mysql cannot be started because the permissions of /var/lib/mysql do not allow access to the mysql service. By default, English mysql calls the mysql user to start the service. Well, now that you know the reason, you can find out why it cannot be started. Start it, it's easy. We only need to chown-Rmysql:mysql/var/lib/mysql. If it still cannot be started, then slowly debug the permissions. Anyway, the failure to start is generally a permissions issue.
If you still can't start it, then use my more complicated permission settings. Anyway, I do this every time, and there is usually no problem. See below:
chown-Rroot/usr/local/mysql
chgrp-Rmysql/usr/local/mysql
chown-Rroot/usr/local/mysql/bin
chgrp-Rmysql/usr/local/mysql/bin
chgrp-Rmysql/var/lib/mysql
chmod777/var/lib/mysql
chown-Rroot/var/lib/mysql/mysql
chgrp-Rmysql/var/lib/mysql/mysql
chmod777/var/lib/mysql/mysql
chown-Rroot/var/lib/mysql/mysql/*
chgrp-Rmysql/var/lib/mysql/mysql/*
chmod777/var/lib/mysql/mysql/*
chmod777/usr/local/mysql/lib/mysql/libmysqlclient.a
After completing the above steps, then COPY a script in your compilation directory.
cpsupport-files/mysql.server/etc/rc.d/init.d/mysqld
chkconfig --addmysqld
Use ntsysv settings to enable mysql to run automatically every time it is started.
Okay, now mysql is installed, you can start your mysql service like this
/etc/rc.d/init.d/mysqldstart
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 don’t have to do this step. You can customize the library file path of myslq when compiling other software, but I still like to link the library file to the default location, so that you don’t need to specify it when compiling software like PHP, Vpopmail, etc. The library file address of mysql.