CentOS installs MySQL via source (available for Raspberry Pi installation)

Source: Internet
Author: User

1, to the MySQL official website download source code http://dev.mysql.com/downloads/mysql/to select Platform: Under Select Source code from below select Generic Linux Then download and transfer to Linux

2, the installation must be dependent on the package

Yum-y install make gcc-c++ cmake bison-devel ncurses-devel libaio libaio libaio-devel perl-data-dumper net-tools

3. Unzip and compile

Tar xvf mysql-5.7.17.tar.gz
CD mysql-5.7.17
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_readline=1 \-dmysql_tcp_port=3306 -denabled_local_infile=1 -dwith_partition_storage_engine=1 -dextra_charsets= All-ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci-ddownload_boost=1-dwith_boost=/usr/local/boost
Make
Make install

4. Create MySQL user and give MySQL user permission to install directory of MySQL program

Useradd mysql-s/sbin/nologin-R mysql:mysql/usr/local/mysql

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

5. Create your own database and tables for MySQL

cd/usr/local/
bin/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql

6, registered as a service

CP Support-files/mysql.server/etc/init.d/mysql

7. Create etc/my.cnf

CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF

8. Add MySQL to the environment variable

[[email protected] rhel5~]# vi/root/. Bash_profile in Path= $PATH: $HOME/Bin add parameter: PATH= $PATH: $HOME/ bin:/usr/local/mysql/bin:/usr/local/mysql/lib[[email protected] rhel5~] #source/root/.bash_profile

9. Set the default password

5. 7 after installation will default to generate a random password stored in/root//root/-u root-p' old password  ' New Password '

10. Start MySQL

Systemctl start MySQL

11. Set up MySQL remote access

Mysql-u root-'root'@'%' your password ' With GRANT OPTION; FLUSH privileges;

12. Set Firewall Add port

Firewall-cmd--zone= public--add-port=3306/tcp--permanent

13, set MYQSL boot

chkconfig–-add mysqlchkconfig mysql on

CentOS installs MySQL via source (available for Raspberry Pi installation)

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.