LNMP Platform Build---mysql installation Chapter

Source: Internet
Author: User
Tags chmod mysql commands mysql version

In the first two, the installation of a basic Web server, but only to provide static Web view, to make a dynamic Web site, you must have a database or other programming language support, here first describes the installation of MySQL database.

MySQL is an open source database, in the Internet industry application is very extensive, the following to record the steps from the source code installation, of course, MySQL also has other installation methods, for example, using yum download install RPM package, or binary installation, if the machine is more, you can build a Yum source, Then customize the RPM package, which makes it easier to install automatically using SSH multi-machine.

Source installation of the MySQL version of 5.5.32, using CMake to compile the installation, the following begins to record the installation steps:

1. Installation Preparation:

MySQL needs to use the CMake tool to compile and rely on the Ncurses-devel library to install them first:

1.1 CMake Installation:

A. Unzip: Tar XF cmake-***

B. cd cmake-**

C../configure, the results are as follows:


Finally, we are prompted to allow gmake.

D. gmake

E. sudo gmake install

F. See if the installation was successful:


1.2 Ncurses-devel Installation:

sudo yum install-y ncurses-devel

2. mysql Installation:

2.1 Creating MySQL users and MySQL user groups

sudo groupadd MySQL

sudo useradd mysql-s/sbin/nologin-m-G MySQL

2.2 Unzip the MySQL archive and enter the MySQL installation directory

CMake. -dcmake_install_prefix=/home/linjk/usr/mysql/mysql-5.5.32-dmysql_datadir=/home/linjk/usr/mysql/mysql-5.5.32/ Data-dmysql_unix_addr=/home/linjk/usr/mysql/mysql-5.5.32/tmp/mysql.sock-ddefault_charset=utf8-ddefault_ Collation=utf8_general_ci-dextra_charsets=gbk,gb2312,utf8,ascii-denable_local_infile=on-dwith_innobase_storage _engine=1-dwith_federated_storage_engine=1-dwith_blackhole_storage_engine=1-dwithout_example_storage_engine=1- Dwithout_partition_storage_engine=1-dwith_fast_mutexes=1-dwith_zlib=bundled-denable_local_infile=1-dwith_ Readline=1-dwith_embedded_server=1-dwith_debug=0

(More compilation options can be viewed from MySQL website: http://dev.mysql.com/doc/internals/en/cmake-howto-detailed.html)

2.3 Perform the "Make && sudo made install" To install the MySQL database, the installation steps may be a bit long. Using the virtual machine, memory is 2G, I make the time about 8 minutes, install about 10 seconds.

2.4 Copy the template configuration file of MySQL to/etc directory:


2.5 to facilitate the use of MySQL commands, configure the environment variables here:

Echo ' Export path=/home/linjk/usr/mysql/mysql-5.5.32/bin: $PATH ' >>/etc/profile, as shown below:


2.6 Initializing the data file:

2.6.1 Change Directory Authorization:

sudo chown-r mysql.mysql/home/linjk/usr/mysql/mysql-5.5.32/data/

sudo chmod-r 1777/tmp/

2.6.2 Initializing the data file:


sudo./mysql_install_db--basedir=/home/linjk/usr/mysql/mysql-5.5.32/--datadir=/home/linjk/usr/mysql/ mysql-5.5.32/data/--user=mysql

2.6.3 Copy the boot script to the/ETC/INIT.D directory:

sudo cp support-files/mysql.server/etc/init.d/mysqld

sudo chmod u+x/etc/init.d/mysqld

2.6.4 Start the database:

Execution: Sudo/etc/init.d/mysqld start

2.6.5 using the command "Netstat-lntup | grep 3306 "To confirm that the start is successful.

2.6.6 can now log in with the command "MySQL"


If you cannot log in, you can try to kill the MYSQD process and reinitialize the data file again.
3. Additional actions that you can continue after installation:

3.1 Delete empty User: Delete from mysql.user where user= '; Improve security

3.2 mysql.user table, ':: 1 ' host name is IPv6, no need or can be deleted

3.3 Delete Test Library: drop database test;

3.4 Initialize user password:

/home/linjk/usr/mysql/mysql-5.5.32/bin/mysqladmin-u root password ' ljk121121 '

3.5 Configuring Boot: sudo chkconfig mysqld on

3.6 New users and other personalized configuration MySQL can


Next, we will introduce the final step of the LNMP platform, and increase the PHP support of the Web server.

LNMP Platform Build---mysql installation Chapter

Related Article

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.