There are many installation tutorials on mysql5.6, but I always encounter various problems when I follow their tutorial, but the author does not point out the solution, then all kinds of Google, refer to everyone's process, finally installation success, record!
1 Download MySQL5.6 source package, and then I was unzipped to/home/cg/my/myapp/below.
2 MySQL from 5.5 versions is not with./configure, but with cmake, so need to install CMake, sudo apt-get instal cmake
3 I was installed in the/home/cg/my/server/mysql directory, I have always had a question why do we all like to install under the/uer/local, so that after the reinstallation of the system does not have anything?? Maybe everyone is copying each other's reasons, copied into the 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 parameters to the meaning, you can go to see the official documents, or here is a more detailed to summarize:. I'll say what I mean 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 character support default all
5 If the configuration error, may need to install Libssl-dev,libncurses5-dev, the first configuration error, the second configuration, the need to delete the source directory under the CMakeCache.txt, and then configure.
6 Compiling, installing
Make
Make install
7 Initializing 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 startup script, boot:
sudo cp/etc/t.d/mysql
sudo chmod 755/etc/init.d/mysql
9 Manual Start
Sudo/etc/init.d/mysql start
PS: If encountered. * The server quit without updating PID file (/home/cg/my/server/mysql/data/cg-lenovo-g470.pid).
So to the problem (I have met).
(1) New users and groups running MySQL
sudo groupadd MySQL
sudo useradd-g mysql MySQL
(2) Setting permissions for the MySQL installation directory
Cd/home/cg/my/server/mysql
sudo chown-r mysql:mysql.
(3) Modify the configuration file my.cnf
The configuration file is in the CMake parameter
Add the following
[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 success!
10 Change the root password:
/home/cg/my/server/mysql/bin/mysqladmin-u root password ' 123456 '
11 Start
sudo mysql start
However, to run Mysql-u directly at the terminal root-p will prompt the program ' MySQL ' Can is found in the following packages:
Solutions
$ '/home/cg/my/server/mysql/bin/mysql '-u root-p.
The ultimate solution, added to the environment variable is that the detailed steps no longer say much.
Compile nginx php mysql--mysql5.6.24 installation from source code