Linux system installation MySQL database

Source: Internet
Author: User
Tags change settings mysql version dedicated server

1, first shut down the Linux firewall, execute the command

Chkconfig iptables off

2. Download your own MySQL version https://dev.mysql.com/downloads/mysql/5.6.html#downloads from MySQL official website, go to MySQL Web site, click

3. mysql file after download

Mysql-5.6.40-linux-glibc2.12-i686.tar.gz

Place the downloaded MySQL compressed file in the Linux/usr/local folder and unzip the compressed file

TAR-ZXVF mysql-5.6.40-linux-glibc2.12-i686.tar.gz

Rename the extracted file to MySQL

MV mysql-5.6.40-linux-glibc2.12-i686 MySQL

4. Create MySQL user group and user

Groupadd mysqluseradd-r-G MySQL MySQL

5. Go to MySQL directory and perform the operation of adding MySQL configuration

CP support-files/my-medium.cnf/etc/my.cnf OR: CP support-files/my-default.cnf/etc/my.cnf

Do you want to overwrite? Press Y to enter

6, edit/etc/my.cnf file;

Vi/etc/my.cnf

Add or modify the relevant configuration in the My.cnf file and save the exit after the change is complete

1 # for advice the change settings2 # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html3 # * * * Don't EDIT this FILE. It ' s a template which 'll be copied to the4 # * * * default location during install, and would be replaced if you5 # * * * * Upgrade to a newer version of MySQL.6 7 [Mysqld]8 9 # Remove Leading # and set to the amount of RAM for the most important dataTen # Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%. One # innodb_buffer_pool_size = 128M A  - # Remove Leading # to turn on a very important data integrity Option:logging - # Changes to the binary log between backups. the # Log_bin -  - # These is commonly set, remove the # and set as required. - Basedir =/usr/local/mysql + DataDir =/usr/local/mysql/data - Port = 3306 + # server_id = ... A socket =/tmp/mysql.sock at character-set-server = UTF8 - Skip-name-resolve - Log-err =/usr/local/mysql/data/error.log - pid-file =/usr/local/mysql/data/mysql.pid -  - # Remove Leading # To set options mainly useful for reporting servers. in # The server defaults is faster for transactions and fast selects. - # Adjust sizes as needed, experiment to find the optimal values. to # join_buffer_size = 128M + # sort_buffer_size = 2M - # read_rnd_buffer_size = 2M the  *Sql_mode=no_engine_substitution,strict_trans_tables

7, in the current directory of MySQL to set the Directory access permissions (note the following dot, indicating the current directory)

Chown-r MySQL. chgrp-r mysql. scripts/mysql_install_db--user=mysqlchown-r root. chown-r MySQL Data

8, initialize the data (in Mysql/bin or mysql/scripts under a mysql_install_db executable file initialization database), into the Mysql/bin or mysql/scripts directory, execute the following command

./mysql_install_db--verbose--user=root--defaults-file=/etc/my.cnf--datadir=/usr/local/mysql/data--basedir=/usr /local/mysql--pid-file=/usr/local/mysql/data/mysql.pid--tmpdir=/tmp

9, start MySQL, enter the/usr/local/mysql/bin directory, execute the following command

./mysqld_safe--defaults-file=/etc/my.cnf--socket=/tmp/mysql.sock--user=root &

10, set the boot start, new open shell interrupt, enter the MySQL directory, execute the following command

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqldcp/usr/local/mysql/support-files/mysql.server/ Etc/rc.d/init.d/mysql
chmod 700/etc/init.d/mysqlchkconfig--add mysqldchkconfig--level 2345 mysqld onchown mysql:mysql-r/usr/local/mysql/

Restart Linux

Reboot

View MySQL Status

Service MYSQLD Status

11. Add Remote access Permissions

(1), add MySQL command

ln  -s/usr/local/mysql/bin/mysql  /usr/bin  (mysql installation path)

(2), Change access rights

Log in to MySQL, execute the following command mysql-uroot-p password is empty direct carriage return, run the following two commands grant all privileges on * * to ' root ' @ '% ' identified by ' Duan ' with Grant O ption; Flush privileges;

Quit MySQL

Exit

Restart Linux and you're done.

Reboot

Note: The local access Mysql,root account default is no password, port number default 3306, if you need to modify the root account password, in the/usr/local/mysql/bin directory, execute the following command

./mysqladmin-h 127.0.0.1-p3306-uroot Password ' Duan ' exit

Linux system installation MySQL database

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.