In Linux, there is no solution for my. cnf file, which is completely self-organized. Many tutorials are nonsense. linuxmy. cnf

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

In Linux, there is no solution for my. cnf file, which is completely self-organized. Many tutorials are nonsense. linuxmy. cnf

I have read a lot about Linux without my. the cnf blog is about rmp installation without my. what are the two methods of cnf file? I am speechless. If you know it, you will not be able to query the information. Do you dare not take charge of it? Details? Some say it is useful to copy a. cnf file from/usr/share/mysql to/etc? If the configuration file is not provided to others, copy a wool card? Everyone will copy it!


My. cnf configuration file:


# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld]#innodb# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.innodb_buffer_pool_size = 4000Minnodb_additional_mem_pool_size=60Minnodb_data_home_dir=innodb_date_file_path=ibdata1:20M:autoextendinnodb_log_group_home_dir=/var/log/innodb_loginnodb_log_files_in_group=2innodb_log_file_size=30Minnodb_log_buffer_size=3Minnodb_doublewrite=ONinnodb_open_file=2000innodb_file_per_table=ONinnodb_max_dirty_page_pct=50back_log=80interactive_timeout=3600key_buffer_size=10Mmax_allow_packet=40440max_connections=1000max_tmp_tables=60query_cache_size=10Msor_buffer_size=10Mtable_open_cache=2000# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.#lob_binlog_bin=ONlog_bin_basename=/var/lib/mysql/mysqld-bin## Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.join_buffer_size = 128Msort_buffer_size = 2Mread_rnd_buffer_size = 2Mdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockcharacter_set_server=utf8#init_connect='SET NAMES utf8'# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Recommended in standard MySQL setupsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES#general_loggeneral_log=ONgeneral_log_file=/var/lib/mysql/localhost.log#slow_query_logslow_query_log=ONslow_query_log_file=/var/lib/mysql/localhost-slow.logslow_launch_time=2[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

If the above file is configured, execute mysql login and throw exceptions such as xxxx. line, go Copy one under/usr/share/mysql. replace the above my. the header code of cnf must be copied to/etc and named my. cnf, and copy the above copy, version information, and some detailed file

The specific path configuration and parameter configuration depend on your own installation


I replaced/Usr/share/mysql/my-default.cnf header file of this sentence:

# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the# *** default location during install, and will be replaced if you# *** upgrade to a newer version of MySQL.[mysqld]

Then [mysqlld] and below are all copied above, starting from the # Number of line 7th in the configuration file above, it can solve the problem similar Fatal error in defaults handling. Program aborted or xxxx line xxxx error. Based on the detailed analysis of your server, my configuration is based on


After configuration, mysql can log on, view, and start the log normally:

mysql> show variables like 'log_%';+----------------------------------------+------------------------------------+| Variable_name                          | Value                              |+----------------------------------------+------------------------------------+| log_bin                                | OFF                                || log_bin_basename                       |                                    || log_bin_index                          |                                    || log_bin_trust_function_creators        | OFF                                || log_bin_use_v1_row_events              | OFF                                || log_error                              | /var/lib/mysql/AY140615022008Z.err || log_output                             | FILE                               || log_queries_not_using_indexes          | OFF                                || log_slave_updates                      | OFF                                || log_throttle_queries_not_using_indexes | 0                                  || log_warnings                           | 1                                  |+----------------------------------------+------------------------------------+11 rows in set (0.01 sec)mysql> show variables like 'log_bin';+---------------+-------+| Variable_name | Value |+---------------+-------+| log_bin       | OFF   |+---------------+-------+1 row in set (0.00 sec)


mysql> select version();+-----------+| version() |+-----------+| 5.6.10    |+-----------+1 row in set (0.02 sec)


If you need to enable it, you can set it by yourself. I hope it will help you, and you will not miss the road!
Linux

7. Change the MySQL directory

The default data file storage directory of MySQL is/var/lib/mysql. To move the directory to/home/data, perform the following steps:

1. Create a data directory under the home Directory
Cd/home
Mkdir data

2. Stop the MySQL service process:
Mysqladmin-u root-p shutdown

3. Move the entire/var/lib/mysql directory to/home/data
Mv/var/lib/mysql/home/data/
In this way, the MySQL data file is moved to/home/data/mysql.

4. Find the my. cnf configuration file.
If my. for the cnf configuration file, go to/usr/share/mysql/and find *. copy one of the cnf files to/etc/and change it to my. cnf. The command is as follows:
[Root @ test1 mysql] # cp/usr/share/mysql/my-medium.cnf/etc/my. cnf

5. Edit the MySQL configuration file/etc/my. cnf.
To ensure that MySQL works properly, you must specify the location where the mysql. sock file is generated. Change socket =/var/lib/mysql. sock to/home/mysql. sock. The procedure is as follows:
Vi my. cnf (use the vi tool to edit the my. cnf file and find the following data to modify)
# The MySQL server
[Mysqld]
Port = 3306
# Socket =/var/lib/mysql. sock)
Socket =/home/data/mysql. sock (add this line)

In the mycnf file in linux, what is the use of userstat = 1?

User status .....

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.