码迷,mamicode.com
首页 > 数据库 > 详细

mysql 增加数据文件

时间:2016-08-11 22:55:17      阅读:397      评论:0      收藏:0      [点我收藏+]

标签:mysql 增加ibdata syntax error

mariadb 增加数据测试

参数文件

    innodb_data_file_path =/data/3306/data/ibdata1:10M:autoextend

改为

    innodb_data_file_path =/data/3306/data/ibdata1:10M:autoextend;/data/3306/data/ibdata2:10M:autoextend


启动就报  

    160811 20:08:33 [ERROR] InnoDB: syntax error in innodb_data_file_path or size specified is less than 1 megabyte


后面的文件不管怎么加都不行,需要将第一个文件的autoextend属性去掉

innodb_data_file_path = /data/3306/data/ibdata1:10M;/data/3306/data/ibdata2:10M:autoextend

启动不再报 syntax error,却报:

InnoDB: Error: data file //data/3306/data/ibdata1 is of a different size

InnoDB: 1152 pages (rounded down to MB)

InnoDB: than specified in the .cnf file 640 pages!

160811 20:25:11 InnoDB: Could not open or create data files.

160811 20:25:11 InnoDB: If you tried to add new data files, and it failed here,

160811 20:25:11 InnoDB: you should now edit innodb_data_file_path in my.cnf back

160811 20:25:11 InnoDB: to what it was, and remove the new ibdata files InnoDB created

160811 20:25:11 InnoDB: in this failed attempt. InnoDB only wrote those files full of

160811 20:25:11 InnoDB: zeros, but did not yet use them in any way. But be careful: do not

160811 20:25:11 InnoDB: remove old data files which contain your precious data!

原来是第一个文件的大小不再是10M,需要改成它实际的大小 

1152*16K/1024=18M

于是改为

innodb_data_file_path = /data/3306/data/ibdata1:18M;/data/3306/data/ibdata2:10M:autoextend


这次启动正常了



注:参数中设置了  innodb_data_home_dir = 

如果不设置,它会默认 innodb_data_home_dir 为 datadir,启动时就会报错:

160811 20:34:09  InnoDB: Operating system error number 2 in a file operation.

InnoDB: The error means the system cannot find the path specified.

InnoDB: If you are installing InnoDB, remember that you must create

InnoDB: directories yourself, InnoDB does not create them.

InnoDB: File name .//data/3306/data/ibdata1

InnoDB: File operation call: ‘create‘.

InnoDB: Cannot continue operation.


相关参数:

The meaning of the parameters set as follows:

innodb_data_home_dirThis is a directory shared set InnoDB tables. If you do not set in my.cnf,InnoDB will use the MySQL datadir directory the default directory. If you set an empty string, you can set the absolute path ininnodb_data_file_path.

 

innodb_data_file_pathSeparate data file specified path and size. The full path of data files and by the innodb_data_home_dir combination of settings here. Specified in the file size in MB. Therefore, the size of the file must be specified after the "M". InnoDB also supports the abbreviation "G", 1G = 1024M. Starting from 3.23.44, large file support in those operating systems can set the data size greater than 4 GB. In some data files on the operating system must be less than 2 GB. The sum of the data file size to reach at least 10 MB. In MySQL-3.23 in this parameter must be explicitly specified in my.cnf. In MySQL-4.0.2 and later you do not need this, the system will default directory in the MySQL datadir create a 16 MB self-expansion (auto-extending) the data file ibdata1. You can also use a native partition (RAW raw disk partitions (raw devices)) as a data file, how to specify them in detail in my.cnf see Section 12.1.
innodb_mirrored_log_groupsTo protect the data set copy of the log file group number, default is 1. In the my.cnf in digital format.
innodb_log_group_home_dirInnoDB log file path. Must be set the same value withinnodb_log_arch_dir. If you do not explicitly specify the default directory in the MySQL datadir create two 5 MB file size ib_logfile ....
innodb_log_files_in_groupLog log file group number. InnoDB in ring mode (circular fashion) to a file. Value 3 is recommended. In the my.cnf in digital format.
innodb_log_file_sizeLog group size of each log file (in MB). If n is log log file group number, then the ideal values for the 1M to the following set of buffer pool (buffer pool) size 1 / n. Larger values can reduce the number of times to flush the buffer pool to reduce disk I / O. However, a large log file means that the collapse takes longer to recover data. Log files must be less than 2 GB, 3.23.55 and 4.0.9 above is less than 4 GB. In the my.cnf in digital format.
innodb_log_buffer_sizeInnoDB log files written to the log disk before the buffer size. Ideal value of 1M to 8M. Large log buffer allows a transaction to run without the log saved to disk but only to the transaction is committed (commit). Therefore, if there is a large transaction, set a large log buffer can reduce disk I / O. In the my.cnf in digital format.
innodb_flush_log_at_trx_commitUsually set to 1, meaning that the transaction log has been submitted written to disk before the transaction can run longer, and service after the collapse of the repair capacity. If you are willing to weaken the security, or you are running small transactions, it can be set to 0, in order to reduce the disk write log file I / O. This option defaults to 0.
innodb_log_arch_dirThe directory where fully written log files would be archived if we used log archiving. This set of parameters must innodb_log_group_home_dirsame. Starting from 4.0.6, you can ignore this parameter.
innodb_log_archiveThis value is usually set to 0. Since the recovery from a backup (recovery) for MySQL using its own log files, which are usually no longer need to archive InnoDB log files. This option defaults to 0.
innodb_buffer_pool_sizeInnoDB is used to cache data and index memory buffer size. Greater access to the data set can reduce disk I / O. In a dedicated database server you can set it to 80% of physical memory. Do not set it too, because the use of physical memory the operating system may affect competition in the page call. In the my.cnf in digital format.
innodb_additional_mem_pool_sizeInnoDB is used to store data dictionary (data dictionary) information and other internal data structures (internal data structures) of memory combinations (memory pool) size. Ideal value of 2M, if there are more tables you need here to re-allocation. If InnoDB exhausted the pool of all the memory it allocates memory from the operating system and error messages written to the MySQL error log. In the my.cnf in digital format.
innodb_file_io_threadsInnoDB file I / O threads. Usually set to 4, but under Windows you can set a higher value to improve disk I / O. In the my.cnf in digital format.
innodb_lock_wait_timeoutRollback (rooled back) before, InnoDB transaction will wait out the time (in seconds). InnoDB will automatically check its own lock table and rollback in the transaction when the deadlock. If you use LOCK TABLEScommand, or in a transaction with the use of other transaction-safe table handler (transaction safe table handlers than InnoDB), it may occur an InnoDB deadlock can not be noticed. In this case, the timeout will be used to solve this problem. The default value is 50 seconds. In the my.cnfin digital format.
innodb_flush_methodThis parameter is only associated with Unix. This parameter defaults tofdatasync. The other set items to O_DSYNC. This affects only the log file dump under Unix fsync dump data. InnoDB version from 3.23.40b started on Unix to use fsync designated fdatasync way, designated for the use ofO_SYNC O_DSYNC way. Since this is also in some Unix environments, so some of the problems in ‘data‘ versions are not being used.
innodb_force_recoveryWarning: This parameter can only be damaged you want from a database dump (dump) data for emergency use! May set the value of the range of 1 - 6. See the following section ‘Forcing recovery‘ in order to understand the specific meaning of this parameter. Parameter value greater than 0 represents the InnoDB prevents users from modifying data security. Starting from 3.23.44, this parameter is available. In themy.cnf in digital format.
innodb_fast_shutdownLack InnoDB insert buffer empty before closing. This operation may take several minutes, in extreme cases can take several hours. If this parameter is set according to 1, InnoDB will skip this process and direct closure. Starting from 3.23.44 and 4.0.1, this parameter is available. Starting from 3.23.50, this parameter defaults to 1.
innodb_thread_concurrencyInnoDB InnoDB service will attempt to use the operating system process is less than or equal to the value set here. This parameter defaults to 8. If the computer system performance shows that many low orinnodb_monitor paternity signal thread, etc., this value should be smaller. If your computer system has a processor and disk I system, this value can be set higher to take full advantage of your system resources. Proposed to be located is the number of processors + number of disks. Starting from 3.23.44 and 4.0.1, this parameter is available. In the my.cnf in digital format.

mysql 增加数据文件

标签:mysql 增加ibdata syntax error

原文地址:http://120662.blog.51cto.com/110662/1837066

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!