CentOS 7 Installation MySQL

Source: Internet
Author: User
Tags install perl

1, prepare MySQL source installation

# wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz

2: Install MySQL dependency for CentOS 7

# yum Install gcc-c++ make CMake bison bison-devel ncurses-devel libaio-devel perl

# yum Install Perl-data-dumper

3: Install CMake, download cmake-2.8.10.2.tar.gz, download it Yourself

# tar-zxv-f Cmake-2.8.10.2.tar.gz

# CD cmake-2.8.10.2

#./configure

# make

# make Install

Next configure the CMake environment variable

# Vi/etc/profile Add the following two lines to the end of the file

Path=/usr/local/cmake-2.8.10.2/bin: $PATH
Export PATH

# Source/etc/profile "After the implementation of the amendments to take effect

# echo $PATH "View PATH value

4: Install MySQL

Create the installation path and the database save path

Installation path: Mkdir-p/usr/lcoal/mysql

Database path: Mkdir-p/usr/local/mysql/data

Create MySQL users and groups

Groupadd MySQL

Useradd-r-G MySQL MySQL

Compile and install MySQL

# tar-zxv-f Mysql-5.5.29.tar.gz

# CD Mysql-5.5.29

#

Cmake-dcmake_install_prefix=/usr/local/mysql \
-dmysql_unix_addr=/usr/local/mysql/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=/mnt/db/mysql/data \
-dmysql_user=root \
-dmysql_tcp_port=5001

# make

# make Install

Check if the installation is successful

To the installation directory LS

Bin COPYING data docs include Install-binary lib man mysql-test README scripts share Sql-bench support-files
Have bin and other documents, congratulations you have successfully installed MySQL.

To add the MySQL startup service to the system service

# CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF

CP: Do you want to overwrite "/etc/my.cnf"? Y

Create a table for the system database

# Cd/usr/local/mysql

# scripts/mysql_install_db--user=mysql

Setting environment variables

# Vi/root/.bash_profile

In modifying the path= $PATH: $HOME/bin is:
Path= $PATH: $HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib

# Source/root/.bash_profile//Make the changes take effect

Manually start MySQL

[Email protected] ~]# cd/usr/local/mysql [[email protected] mysql]#./bin/mysqld_safe--user=mysql &//start MySQL, but not stop Stop mysqladmin-u root-p shutdown//At this time root has no password, so the null value, prompt for the password, enter directly.

To add the MySQL startup service to the system service

[email protected] mysql]# CP Support-files/mysql.server/etc/init.d/mysql

Start MySQL

[[Email protected] mysql]# service mysql start starting mysql ... error! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).

Startup failure: I'm here for permission issues, change permissions first [[email protected] mysql]# chown-r mysql:mysql/usr/local/mysql

Then start the server [[email protected] mysql]#/etc/init.d/mysql start

Modify the password of the root user of MySQL and open the remote connection

[[email protected] mysql]# mysql-u root MySQL

mysql> use MySQL;  mysql> desc User; Mysql> GRANT All privileges on * * to [email protected]'% ' identified by ' root '; The ability to add remote connections for root mysql> update user Set Password = Password (' 123456 ') where user= ' root ';  Set root user password mysql> select Host,user,password from User where user= ' root ';  mysql> flush Privileges; Mysql> exit

Re-Login

[Email protected] mysql]# mysql-u root-p Enter password:123456

If you are unable to connect remotely, shut down the firewall [email protected]]#/etc/rc.d/init.d/iptables Stop

CentOS 7 Installation 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.