Fully-functional Web server in Linux _ MySQL

Source: Internet
Author: User
A friendly prompt for Web servers with complete configuration functions in Linux: debugging environment: Redhat9.0Apache1.3.29Mysql3.23.58PHP4.3.4 I will not talk about the installation of Linux. this is a basic skill, in fact, this article should also be used in other linux systems like Redhat. you only need to master the methods I provide. Remember to install Redhat9. Do not install the default apache, mysql, php, and related software. Already


Debugging environment: Redhat9.0Apache1.3.29Mysql3.23.58PHP4.3.4

I will not talk about Linux installation. this is a basic skill. In fact, this article is applicable to other linux systems similar to Redhat. you only need to master the methods I provide. Remember to install Redhat9. Do not install the default apache, mysql, php, and related software. Use rpm-e * to delete installed packages.

1. install Mysql3.23.58

In fact, it is quite feasible to directly install the rpm package provided by the official Mysql website. The rpm package provided by his official website is basically synchronized with the tar package release, I like this very much. at least the rpm package will not be found in the mysql library file during subsequent debugging. However, it is necessary to talk about the steps for custom installation. after all, there are a lot of user-defined installation steps.

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/mysqlmysql installation target Directory

# Sysconfdir =/etcmy. ini configuration file path

# Localstatedir =/var/lib/mysql database storage path

Initialize the database after installation. you do not need to perform this step if you upgrade the database;

/Usr/local/mysql/bin/mysql_install_db

If the system does not have a mysql User, do the following:

Useradd-M-o-r-d/var/lib/mysql-s/bin/bash-c "MySQLServer"-u27mysql

Then I start mysql

/Usr/local/mysql/bin/safe_mysqld &

OK. check if mysql works properly.

Mysql-urootmysql

Generally, the database cannot be connected normally. the error message is:

ERROR2002: Can 'tconnecttolocalmysqlserverthroughsocket '/var/lib/mysql. sock' (2)

In fact, most of the questions on the Internet are the whole question, and the link to the question cannot be mysqld. sock. In fact, let's take a look at the mysql error log to understand what is going on. The error log here is in/var/lib/mysql /*. err, you will find that mysql cannot be started only because/var/lib/mysql does not allow access to the mysql service. by default, mysql calls the mysql User to start the service, since you know why it cannot be started, it's easy. We only need chown-Rmysql: mysql/var/lib/mysql. if it still cannot be started, you can debug the permission slowly. generally, it is a permission issue if it cannot be started.

If you still cannot start it, use my complicated permission settings. I do this every time. Generally, there is no problem. see:

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

Chgrp-Rmysql/var/lib/mysql

Chmod777/var/lib/mysql

Chown-Rroot/var/lib/mysql /*

Chgrp-Rmysql/var/lib/mysql /*

Chmod777/var/lib/mysql /*

Chmod777/usr/local/mysql/lib/mysql/libmysqlclient.

After completing the above steps, COPY a script in your compiled Directory

Cpsupport-files/mysql. server/etc/rc. d/init. d/mysqld

Chkconfig -- addmysqld

Set ntsysv to enable mysql to run automatically at each startup.

Now that mysql is installed, you can start your mysql service.

/Etc/rc. d/init. d/mysqldstart

The following steps are critical,

Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql

Ln-s/usr/local/mysql/include/mysql/usr/include/mysql

You can skip this step. you can customize the myslq library file path when compiling other software, but I still like to link the library file to the default location, so that you are compiling PHP like, when using software such as Vpopmail, you do not need to specify the mysql library file address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.