LNMP environment Installation One, Mysql5.7 installation

Source: Internet
Author: User

Compiling and installing mysql-5.7.17

1. Open the official website to download the latest mysql-5.7.17 Source Package

Note: Select Source Download

2. Save boost/mysql or mysql-boost in a custom directory

Http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

Http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.11.tar.gz

Http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.11.tar.gz

3. install the dependency package and compile the tool

Yum install-y gcc-c++ make CMake bison bison-devel ncurses-devel libaio-devel perl perl-data-dumper

4. Create mysql users and groups first to see if they already exist

cat/etc/passwd |  /etc/group | grep MySQL

New MySQL user and user group not created :

-r-g mysql-s/bin/false MySQL #创建不可登陆用户

5. Create MySQL installation directory and data directory

1 mkdir/usr/local/mysql2 mkdir/usr/local/mysql/data

6. Create the boost directory and move the boost file to this directory, or cmake will error

Tar-zxvf boost_1_59_0.tar.gzMv boost_1_59_0.tar.gz   /usr/local/boost

7. compiling MySQL

CMake-dcmake_install_prefix=/usr/local/mysql \ #安装目录-dmysql_unix_addr=/usr/local/mysql/mysql.sock \ #sock目录-ddefault_charset=UTF8 \ #默认编码-ddefault_collation=utf8_general_ci \ #默认效验规则-dwith_myisam_storage_engine=1\ #激活myisame-dwith_innobase_storage_engine=1\ #激活innodb-dwith_memory_storage_engine=1\ #激活memory-dwith_readline=1\ #快捷键功能-denabled_local_infile=1\ #允许导入数据-dmysql_datadir=/usr/local/mysql/data \ #数据目录-dmysql_user=mysql \ #用户名-dmysql_tcp_port=3306\ #端口-dwith_boost=/usr/local/boost #增强插件

8. installation patience wait ...

Make && make install

9. After the installation is complete, modify /etc/my.cof as follows

[Mysqld]basedir=/usr/local/mysqldatadir=/usr/local/mysql/datasocket=/usr/local/ mysql/Mysql.sockuser=mysqlsymbolic-links=0Skip-grant-tables  //  Skip the permission table to add the command [mysqld_safe]log-error=/usr/local/mysql/logs/mysqld.logpid-file= /usr/local/mysql/mysqld.pid  

Create A logs directory

Mkdir/usr/local/mysql/logs

Modify the MySQL directory owner

Chown-r Mysql:mysql/usr/local/mysql

One. Initializing the database

bin/mysqld   --initialize--user=mysql   --basedir=/usr/local/mysql   -- Datadir=/usr/local/mysql/data

Command parameter explanation:

--defaults-file : Developing a MySQL profile Path

--initialize : Initialize the random password, note that the initialized password is an expired password, after login need to change the password

--user: Specify account

After the last command is executed, a random password is given at the end of the command prompt.

Be sure to remember log this password down

Note: Previous versions of mysql_install_db were under Mysql_basedir/script,

5.7 is placed in the mysql_install_db/bin directory and has been discarded
"–initialize" generates a random password (~/.mysql_secret),

and "–initialize-insecure" does not generate a password
–datadir cannot have data file under target directory

The host of MySQL installation files ( except data) is changed to root To avoid restoring the database to factory settings.

Chown-r root/usr/local/-R mysql/usr/local/mysql/data

1 3 . Add MySQL Service

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql

start MySQL

Service MySQL Start

Show startup success: Starting MySQL ..... success!

1 5 link MySQL

/usr/local/mysql/bin/mysql-uroot-p

After the installation of MySQL , after landing, regardless of running any command, always prompt to reset the password

1: SET PASSWORD = PASSWORD ('your new PASSWORD'2'  Root'@'localhost'3: Flush privileges;

Complete the above three steps to exit the re-login, using the new settings of the password on the line, the above in addition to the red self-modification into a new password, other as-is input can

set to auto start on boot

Chkconfig--add MySQL

"mysql-boost-5.7 installation (including How to install the Boost package) "

1. Installation Dependencies

Yum-y install make gcc-c++ cmake bison-devel  ncurses-devel   Bison perl perl-devel  Perl perl-devel

2. unzip MySQL

TAR-ZXVF mysql-boost-5.7. tar.gz.

3. create users and Groups

-r-g mysql-s/bin/false MySQL

4. compiling mysql

cd/tar/mysql-5.7. One/-dcmake_install_prefix=/usr/local/-ddefault_charset=-ddefault_collation =-dwith_boost=&& make install

5. back up the original configuration file

cp/etc/my.cnf/etc/-f/etc/my.cnf

6. Modify mysql users and Groups

cd/usr/local/-

7. Create a Data Catalog

Mkdir-p/data/mysql/data/

8. initialize mysql to turn on SSL

bin/--initialize---user=--basedir=/usr/local/--datadir=/data/mysql/
Bin/mysql_ssl_rsa_setup --user=--basedir=/usr/local/--datadir=/data/ Mysql/data

9. The settings will root to prevent accidental deletion

Chown-r root/usr/local/-R mysql/usr/local/mysql/data

Copy configuration file and start

CP support-files/my-default. cnf/etc//usr/local/mysql/support-files/mysql.server/etc/init.d/ Mysql

Set Environment Variables

Vi/etc/profile

# Add two lines at the end of the profile file

path=/usr/local/mysql/bin:/usr/local/mysql/Lib: $PATHexport PATH

# make path search paths effective immediately:

Source/etc/profile

Configuration

vi/etc/my.cnf# Modify line 19th (uncomment and modify to)   =/data/mysql/data/

Start- up

Service MySQL Start

LNMP environment Installation One, Mysql5.7 installation

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.