FreeBSD installation Configuration mysql+apache+php Novice Guide (1/3)

Source: Internet
Author: User

A. Install MySQL

I use the MySQL is 4.0.20, source code version, you can also use the RPM package or binary sedan, installation method may not be the same, please refer to other articles.
First download the source code version of Mysql2.0.20, address: http://dev.mysql.com/downloads/mysql/4.0.html
Put it down to the/USR/LOCAL/SRC directory, and if you don't have the directory, build one yourself. Download the package name called mysql-4.0.20.tar.gz, and then we unpack it:

The code is as follows Copy Code

# TAR-ZXVF Mysql-4.0.20.tar.gz

After decompression generates the mysql-4.0.20 directory, we enter the directory:

The code is as follows Copy Code

# CD mysql-4.0.20

After the entry began to configure MySQL, the configuration process we want to give MySQL set up a directory of installation, we set up under the/usr/local/mysql, think that the file to a place easier to manage, if you want to get more configuration information, use./configure-- Help

The code is as follows Copy Code

#./configure--prefix=/usr/local/mysql

The above commands specify the installation path for MySQL, and then wait a few seconds to compile the source code after the configuration is complete:

The code is as follows Copy Code

# make

The compilation process is relatively long, if the machine is slow, it may be nearly 20 minutes (PS: My machine is a very common machine, all used almost 15, 6 minutes).
Install after the compilation is complete:

The code is as follows Copy Code

# make Install

Wait a few seconds, the installation is complete. The following is the most critical part, why the old installation is not successful, (PS: At least I was installed n times, n > 10, hehe), the crux of the problem here, access to MySQL to a dedicated user, and must give the appropriate access rights, Here we will set root and MySQL have access to permissions.
We first set up a MySQL and MySQL user to access MySQL:

The code is as follows Copy Code
# PW Groupadd MySQL #建立mysql组
# PW Useradd mysql-g MySQL

#建立mysql用户并且加入到mysql组中, it is best to reuse chpass to remove the MySQL user's landing shell, such as/sbin/nologin, in order to prevent future authorized user access.

We initialize the table after the user is established (note: You must perform this step before you can do the following steps)

The code is as follows Copy Code
#./scripts/mysql_install_db--user=mysql

#初试化表并且规定用mysql用户来访问

After initializing the table, we start to give MySQL and root user access rights, we first to install MySQL directory:

The code is as follows Copy Code

# Cd/usr/local/mysql

And then Set permissions

The code is as follows Copy Code

# Chown-r Root. #设定root能访问/usr/local/mysql
# chown-r mysql var #设定mysql用户能访问/usr/local/mysql/var, where the MySQL database file is stored
# chown-r MySQL var/. All files under the #设定mysql用户能访问/usr/local/mysql/var
# chown-r MySQL var/mysql/. All files under the #设定mysql用户能访问/usr/local/mysql/var/mysql
# chgrp-r MySQL. #设定mysql组能够访问/usr/local/mysql

Home 1 2 3 last

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.