Source Code installation software-mysql

Source: Internet
Author: User

First, the source installation

1, the classic source code installation three-step song :

1, pre-compilation configuration

    ./configure

2. Compiling

   Make

3. Installation

    Make install

2, the source code software installation steps:

1. Download the package

2. Verifying software packages

3. Unpacking

4. Enter the directory to be unpacked

5. read the Readme and install files carefully

6. Follow the installation steps in the Readme or install file

experimental environment setup:

1, basic server installation options

2, configuring disk 80G, Swap 1024M, other assigned to/partition

3, after installation, configure the network

host name, IP address,/etc/hosts, Default gateway

4, Turn off SELinux, iptables

5, configuring Yum

6, configure SECURECRT login, Hostonly or bridging the network

Two, source installation MySQL 5.7

shell> pwd #mysql的安装目录

/usr/local/mysql

1. Before compiling and installing MySQL

shell> Yum install-y gcc,gcc-c++,make,ncurses-devel #编译环境

2. Compile and install CMake

Shell> Tar XF cmake-3.6.2.tar.gz-c/usr/local/src/

Shell> cd/usr/local/src/cmake-3.6.2/

Shell>./bootstrap

Shell> make

shell> make Install

3, upload boost_1_59_0.tar.gz to Linux , such as upload to/USR/LOCAL/SRC

4. Compile and install MySQL

shell> Groupadd MySQL

Shell> Useradd-r-G mysql-s/bin/false MySQL

Shell> Tar XF mysql-5.7.14.tar.gz-c/usr/local/src/

Shell> cd/usr/local/src/mysql-5.7.14

Shell> CMake. -DWITH_BOOST=/USR/LOCAL/SRC #boost_1_59_0. tar.gz stored in "/USR/LOCAL/SRC"

Shell> make

shell> make Install

Shell> Cd/usr/local/mysql

shell>/usr/local/mysql/bin/mysqld--initialize--datadir=/mydata--user=mysql #mysql初始化, generate some MySQL system libraries, just do it once

5. Modify the MySQL configuration file

shell> vim/etc/ MY.CNF

 [mysqld]datadir  =/mydata //  Modify to the previous step to initialize the specified datadir   User  =mysqlsocket  =/var /lib/mysql /mysql.sock  //  The  //  [mysqld_safe]log -error=/var /log/mysqld.logpid -file=/mydata/mysqld.pid //  generate DataDir under Mysql.pid   

6. Start MySQL

Shell> Cd/usr/local/mysql

Shell> Bin/mysqld_safe--user=mysql &

7. Check if MySQL is starting successfully

Shell> Netstat-an | grep:3306

TCP 0 0::: 3306:::* LISTEN

8. Log in to MySQL

shell>/usr/local/mysql/ bin/mysql-uroot-p-s/var/lib/mysql/mysql.sock

#-s Specify the sock file, you can view the MySQL sock file through the PS process

9. hack MySQL Password

1. Stop MySQL: Kill

2, Shell> vim/etc/my.cnf

Increase Skip-grant-tables

3. Start the MySQL service

4. Log in to MySQL

shell> mysql-uroot-p-s/mydata/mysql.sock #跳过密码启动, you can Direct Carriage Enter

5. Loading Authorization Form

mysql> flush Privileges;

6. Modify the user password in the MySQL library

mysql> use MySQL;

mysql> alter user ' root ' @ ' localhost ' identified by ' Password (custom) ';

7. Stop MySQL

Mysql> shutdown;

8, Shell> vim/etc/my.cnf

Comment Skip-grant-tables

9. Start the MySQL service

10. mysql Shutdown

1, abnormal: Kill process kill-9 PID PPID

2, normal:mysql> shutdown; or mysql> quit;

Third, source installation MySQL 5.6

1. shell> Yum install gcc gcc-c++ ncurses-devel bison

2. shell> Yum Install CMake Readline-devel

3. Set up users and groups

shell> Groupadd MySQL

Shell> useradd-r-G MySQL MySQL

4, Mkdir-p/usr/local/mysql/data

5, Chown-r mysql:mysql/usr/local/mysql/

6. Tar zxvf mysql-5.6.29.tar.gz

7, shell> mkdir project; CD project/

shell> pwd

/software/mysql-5.6.29/project

8, CMake. /

9, make; Make Install

10, Rm-f/etc/my.cnf

11. Initialization

shell>./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data/-- Defaults-file=/usr/local/mysql/my.cnf

12. Edit the My.cnf file

 shell> vim/etc/my.cnf[mysqld]  //  server  datadir  =/mydatasocket  =/var /lib/mysql/< Span style= "COLOR: #000000" >mysql.sock# disabling symbolic -links is   recommended to prevent assorted security riskssymbolic -links= 0   [mysqld_safe]log -error=/var /log/mysqld.logpid -file=/mydata/mysqld.pid [MySQL]  Span style= "COLOR: #008000" >//  client  socket  =/var /lib/mysql/mysql.sock  

13. Edit the PATH environment variable

Shell> Echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/ Mysql/bin

14. Start the MySQL service

shell> CP./support-files/mysql.server/etc/init.d/

Shell> Service Mysql.server Stop

Shutting down MySQL. [OK]

Shell> Service Mysql.server Start

Starting MySQL. [OK]

15. Enter MySQL

shell> mysql-uroot-p #空密码进入, 5.6 Default no password

16. Configure user passwords and remote access permissions

1. Connection System Permissions Database

mysql> use MySQL;

Database changed

2. Set the password

mysql> Update user set Password=password ("123") where user= "root";

Query OK, 3 rows affected (0.06 sec)

Rows Matched:5 Changed:3 warnings:0

3. Refresh Permissions

mysql> flush Privileges;

Query OK, 0 rows affected (0.03 sec)

4. Exit

Source Code installation software-mysql

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.