MySQL Installation and configuration summary

Source: Internet
Author: User
Tags mysql version

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MySQL Installation and configuration summary:

For MySQL database related information, do not do a summary here, the students need to consult the relevant information. In addition, this article summarizes the topic of MySQL installation, configuration and service operations.

· Installation

· Configuration

· Operation

· Problem

First, installation

Different system installation method is slightly different, here is installed in Mac OSX, so you can use homebrew to install, for Linux under the installation method, please see:

Http://www.cnblogs.com/quanzhiguo/p/7520651.html

$ brew Install MySQL

Note:

Download the installation online, the advantage is that the installation of the software is relatively new, bad place is the network slow, slow download.

Second, the configuration

1. my.cnf file

In order to avoid the MySQL version upgrade, overwrite the my.cnf file, it is recommended to move the file location under/etc/, the default location is/USR/LOCAL/CELLAR/MYSQL/5.7.11/MY.CNF, the operation is as follows:

$ sudo mv/usr/local/cellar/mysql/5.7.11/my.cnf/etc/

2. MY.CNF Configuration

The following is an optimized configuration for the MY.CNF configuration file, as follows:

[Mysqld]

Port = 3306

server_id = 1

Character-set-server = UTF8

Default-storage-engine = INNODB

Socket =/tmp/mysql.sock

Skip-external-locking

Key_buffer = 16K

Query_cache_limit = 256K

Query_cache_size = 4M

Max_allowed_packet = 1M

Table_open_cache = 128 # Table cache number, typically a multiple of max_connections

Max_connections = 32

Thread_concurrency = 2

Sort_buffer_size = 64K

Read_buffer_size = 256K

Read_rnd_buffer_size = 256K

Net_buffer_length = 2K

Thread_stack = 64K

Sql_mode=no_engine_substitution,strict_trans_tables

[Mysqldump]

Quick

Max_allowed_packet = 16M

[MySQL]

No-auto-rehash

Default-character-set = UTF8

[Isamchk]

Key_buffer = 8M

Sort_buffer_size = 8M

[Myisamchk]

Key_buffer = 8M

Sort_buffer_size = 8M

[Mysqlhotcopy]

Interactive-timeout

Third, the operation

For MySQL service operation, mainly is [Start|stop|restart], in order to simplify the operation, we modify the next/etc/profile file, add the following content:

Alias mysqlstart= "/usr/local/opt/mysql/bin/mysql.server start"

Alias mysqlstop= "/usr/local/opt/mysql/bin/mysql.server Stop"

Alias mysqlrestart= "/usr/local/opt/mysql/bin/mysql.serverrestart"

$ source/etc/profile # Causes the profile to take effect immediately, then directly:

$ mysqlstart//Start service

$ mysqlstop//Stop service

$ mysqlrestart//Restart Service

Specific as follows:

Iv. issues

1. Start MySQL Service error

Problems encountered:

ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

The problem arises:

The MySQL system is having a problem due to repeated installation of MySQL (the latest installation is MySQL 5.7).

Mysql 5.7 has made some adjustments compared to previous versions, so the best solution is to back up the original database data and reinitialize a new instance.

Workaround:

$mysqld--defaults-file=/etc/my.cnf--user=mysql--datadir=/var/mysql/data--initialize--initialize-insecure

Note:

After Mysql 5.7, you need to use mysqld to initialize, and 5.6 and before, use mysql_install_db;

--defaults-file, specify the MY.CNF global configuration file we use;

--datadir, specify the directory of data installation, need to ensure that the database directory is empty, and have write permission;

--initialize-insecure, if added this command, will create a blank password of the [email protected] account, otherwise generate a non-blank password [email protected] account, and the password is saved in the log file (in 5.6 version is placed in ~/.mysql_secret file);

Ps:

There are many reasons for causing the above error, for example:

A, configuration file my.cnf configuration error

B, my.cnf appear multiple, resulting in coverage problems

For specific issues, please also check the error log analysis trace.

2, waiting to be updated ...

MySQL Installation and configuration summary

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.