Install lnmp mysql and lnmpmysql
Install mysql in linux
# Yum-y install make gcc-c ++ cmake bison-devel ncurses-devel // install the package required for compiling code
# Wget http://www.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz // download mysql package
# Tar-zxvf mysql-5.6.27.tar.gz // unzip mysql package
# Cd mysql-5.6.27
/Use Cmake to compile:
# Cmake \
-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DMYSQL_DATADIR =/usr/local/mysql/data \
-DSYSCONFDIR =/etc \
-DWITH_MYISAM_STORAGE_ENGINE = 1 \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_MEMORY_STORAGE_ENGINE = 1 \
-DWITH_ARCHIVE_STORAGE_ENGINE = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITH_READLINE = 1 \
-DENABLE_DOWNLOADS = 1 \
-DENABLED_LOCAL_INFILE = 1 \
-DMYSQL_UNIX_ADDR =/var/lib/mysql. sock \
-DMYSQL_TCP_PORT = 3306 \
-DEXTRA_CHARSETS = all \
-DDEFAULT_CHARSET = utf8mb4 \
-DDEFAULT_COLLATION = utf8mb4_unicode_ci
Make & make install
The installation process may take a long time.
2. Configure MySQL
Check whether mysql users and user groups exist.
Cat/etc/passwd view User List
Cat/etc/group: view the user group list. If no user group list exists, create it.
Groupadd mysql
Useradd-g mysql
Modify/usr/local/mysql Permissions
Chown-R mysql: mysql/usr/local/mysql
Enter the installation path
Cd/usr/local/mysql
Go to the installation path, execute the initialization configuration script, and create the database and table that comes with the system.
Scripts/mysql_install_db -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data -- user = mysql
When executing the mysql_install_db command, you must add the following parameters. -- user indicates the running user, -- basedir indicates the MySql installation directory, and -- datadir indicates the directory where the database data is located.
Note: when starting the MySQL service, I will be searched in certain order. cnf, which is first found in the/etc directory. If no cnf is found, "$ basedir/my. cnf ", in this example/usr/local/mysql/my. cnf, which is the default location of the new MySQL configuration file! Note: After the minimal installation of the CentOS 6.4 operating system is completed, a my. cnf, You need to rename this file to another name, such as:/etc/my. cnf. bak. Otherwise, the file will interfere with the correct configuration of MySQL installed by source code, resulting in startup failure.
Start MySQL
Add a service, copy the service script to the init. d directory, and set startup
Cp support-files/mysql. server/etc/init. d/mysql
Chkconfig mysql ON
Service mysql start -- start MySQL to configure the user
** An error is reported during startup:
1) Starting MySQL .. The server quit without updating PID file ([FAILED]/mysql/iZ2zegxohhsdr2ypoihxvsZ. pid )?
Solution:
1) mysql uses the/etc/my. cnf configuration file when the configuration file is not specified at startup,
Open this file to check whether the data directory (datadir) is specified in [mysqld ).
Datadir =/usr/local/mysql/data, and remove #
Before setting, we need to set the PATH first, or we cannot directly call mysql
Modify the/etc/profile file and add
PATH =/usr/local/mysql/bin: $ PATH
Export PATH
Make the configuration take effect immediately
# Source/etc/profile
Mysql-uroot // enter mysql
Mysql> set password = PASSWORD ('root'); // SET the PASSWORD
Mysql> grant all privileges on *. * TO 'root' @ '2014. 192.% 'identified by 'troot' with grant option; // set Remote Access
================= Password errors cannot be found in the database =============================== ========
#/Etc/init. d/mysql stop
# Mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
# Mysql-u root mysql
Mysql> UPDATE user SET Password = PASSWORD ('newpassword') where USER = 'root ';
Mysql> flush privileges;
Mysql> quit
#/Etc/init. d/mysql restart
# Mysql-uroot-p
Enter password: <Enter the new password newpassword>
================== Mysql authorized remote access =========================== ========
1. grant all privileges on *. * TO 'root' @ '47. 100.16.97 'identified BY 'root @ 100' with grant option;
Or
2. grant all privileges on *. * TO root @ '%' identified by 'root666 @ root' with grant option;
3. flush privileges;
As a result, this installation is complete for your reference only. We recommend that you make progress together.