Compile nginxphpmysql from the source code -- install mysql5.6.24

Source: Internet
Author: User

Compile nginxphpmysql from the source code -- install mysql5.6.24

There are many installation tutorials on mysql5.6 on the Internet, but I always encounter various problems when installing them according to their tutorial, but the author did not point out the solution, refer to everyone's process, and finally install successfully. Record it!

1. Download The MySQL5.6 source code package and decompress it to/home/cg/my/myapp.

2 mysql versions later than mysql 5.5 do not use./configure, but cmake, so you need to install cmake, sudo apt-get instal cmake

3. I installed it in the/home/cg/my/server/mysql directory. I have always wondered why everyone prefers to install it under/uer/local, in this way, nothing will happen after the system is reinstalled ?? Maybe all of us copied them into a habit.

4 cd // home/cg/my/myapp/mysql-5.6.24
Cmake \
-DCMAKE_INSTALL_PREFIX =/home/cg/my/server/mysql \
-=/Home/cg/my/server/mysql \
-DMYSQL_DATADIR =/home/cg/my/server/mysql/data \
-DMYSQL_TCP_PORT = 3306 \
-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock \
-DEXTRA_CHARSETS = all
If you want to know the meaning of the parameters, you can go to the official documentation, or here is a more detailed summary :. I would like to explain it here.
DCMAKE_INSTALL_PREFIX installation directory
DSYSCONFDIR configuration file (my. cnf) Directory
DMYSQL_DATADIR data storage directory
DMYSQL_TCP_PORT TCP/IP Port
DMYSQL_UNIX_ADDR UNIX socket File
DEXTRA_CHARSETS extended characters support all by default

5 Tib, and then configure.

6. Compile and install
Make
Make install

7. initialize the database:

Chmod 755 scripts/mysql_install_db
Scripts/mysql_install_db-basedir =/home/cg/my/server/mysql/-datadir =/home/cg/my/server/mysql/data/

8. Copy the startup script and start it automatically:
Sudo cp/etc/t. d/mysql
Sudo chmod 755/etc/init. d/mysql

9 manual start
Sudo/etc/init. d/mysql start
PS: If you encounter. * The server quit without updating PID file (/home/cg/my/server/mysql/data/cg-Lenovo-G470.pid ).
This leads to the problem (I have encountered ).
(1) create a user and group for running Mysql
Sudo groupadd mysql
Sudo useradd-g mysql

(2) Set Mysql installation directory permissions
Cd/home/cg/my/server/mysql
Sudo chown-R mysql: mysql ./

(3) modify the configuration file my. cnf
The configuration file is stored in the cmake parameter.
Add

[Client]
Port = 3306
Socket =/home/cg/my/server/mysql/data/mysql. sock

[Mysqld]
Port = 3306
Socket =/home/cg/my/server/mysql/data/mysql. sock
Basedir =/home/cg/my/server/mysql
Datadir =/home/cg/my/server/mysql/data
OK
Sudo mysql start is successful!

10 change the root password:

/Home/cg/my/server/mysql/bin/mysqladmin-u root password '123'

11. Start
Sudo mysql start

However, if you want to run mysql-u root-p directly on The terminal, the system will prompt The program 'mysql' can be found in the following packages:
Solution
$ '/Home/cg/my/server/mysql/bin/mysql'-u root-p.

The ultimate solution is to add it to the environment variable.

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.