Home Database Mysql Tutorial 【mysql案例】mysql5.6.14配置my.cnf多实例,mysql_install_db初_MySQL

【mysql案例】mysql5.6.14配置my.cnf多实例,mysql_install_db初_MySQL

Jun 01, 2016 pm 01:14 PM
mysql Configuration file

1.1.1. mysql5.6.14多实例my.cnf时,初始化不读取my.cnf配置文件

【环境描述】

在多实例配置的/etc/my.cnf环境中,执行mysql_install_db后,启动Mysql报错。

【操作步骤】

/etc/my.cnf配置文件:

[mysqld3307]

innodb_data_file_path =ibdata1:1G:autoextend

初始化数据库:

[root@test home]# mysql_install_db--datadir=/home/mysql_3307 --user=mysql --defaults-file=/etc/my.cnf

Installing MySQL system tables...2014-05-1311:07:33 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentationfor more details).

2014-05-13 11:07:33 8897 [Note] InnoDB: TheInnoDB memory heap is disabled

2014-05-13 11:07:33 8897 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins

2014-05-13 11:07:33 8897 [Note] InnoDB:Compressed tables use zlib 1.2.3

2014-05-13 11:07:33 8897 [Note] InnoDB:Using Linux native AIO

2014-05-13 11:07:33 8897 [Note] InnoDB:Using CPU crc32 instructions

2014-05-13 11:07:34 8897 [Note] InnoDB:Initializing buffer pool, size = 128.0M

2014-05-13 11:07:34 8897 [Note] InnoDB:Completed initialization of buffer pool

2014-05-13 11:07:34 8897 [Note] InnoDB: Thefirst specified data file ./ibdata1 did not exist: a new database to becreated!

2014-05-13 11:07:34 8897 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB

2014-05-13 11:07:34 8897 [Note] InnoDB:Database physically writes the file full: wait...

2014-05-13 11:07:34 8897 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB

2014-05-13 11:07:34 8897 [Note] InnoDB:Setting log file ./ib_logfile1 size to 48 MB

2014-05-13 11:07:35 8897 [Note] InnoDB:Renaming log file ./ib_logfile101 to ./ib_logfile0

2014-05-13 11:07:35 8897 [Warning] InnoDB:New log files created, LSN=45781

2014-05-13 11:07:35 8897 [Note] InnoDB:Doublewrite buffer not found: creating new

2014-05-13 11:07:35 8897 [Note] InnoDB:Doublewrite buffer created

启动mysql实例时,error.log报错:

2014-05-13 11:11:15 8989 [Note] InnoDB:Completed initialization of buffer pool

2014-05-13 11:11:15 8989 [ERROR]InnoDB: auto-extending data file ./ibdata1 is of a differentsize 768 pages (rounded down to MB) than specified in the .cnf file: initial65536 pages, max 0 (relevant if non-zero) pages!

2014-05-13 11:11:15 8989 [ERROR] InnoDB:Could not open or create the system tablespace. If you tried to add new datafiles to the system tablespace, and it failed he

re, you should now editinnodb_data_file_path in my.cnf back to what it was, and remove the new ibdatafiles InnoDB created in this failed attempt. InnoDB only wrote

those files full of zeros, but did not yetuse them in any way. But be careful: do not remove old data files which containyour precious data!

2014-05-13 11:11:15 8989 [ERROR] Plugin'InnoDB' init function returned error.

2014-05-13 11:11:15 8989 [ERROR] Plugin'InnoDB' registration as a STORAGE ENGINE failed.

2014-05-13 11:11:15 8989 [ERROR]Unknown/unsupported storage engine: InnoDB

2014-05-13 11:11:15 8989 [ERROR] Aborting

2014-05-13 11:11:15 8989 [Note] Binlog end

2014-05-13 11:11:15 8989 [Note] Shuttingdown plugin 'partition'

2014-05-13 11:11:15 8989 [Note] Shuttingdown plugin 'ARCHIVE'

         虽然执行mysql_install_db命令的时候指定了读取/etc/my.cnf配置文件,但是进行初始化创建数据库的时候,实际上没有读取:

         初始化时的输出日志:

                  2014-05-13 11:07:34 8897 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB

         查看/home/mysql_3307/ibdata1的大小:

                  [root@ test mysql_3307]# ls -ltrh |grep ibdata1

                  -rw-rw---- 1 mysql mysql  12M May 13 11:07 ibdata1

         可以发现实际创建的ibdata1文件大小也是mysql默认的12M,而非配置文件中配置的1G大小,在启动实例时遇到的报错,也是说ibdata1文件大小跟配置文件中的不匹配。

【报错原因】

         在mysql5.6.14版本中,mysql_install_db命令读取my.cnf配置文件时,只会读取[mysqld]配置模块,它不会读取多实例中配置的[mysqldNNN],所以在本案例中,虽然my.cnf配置了ibdata大小为1G,但是mysql仍然使用默认的12M。

【解决方法】

         修改my.cnf,把[mysqldNNN]依次修改为[mysqld],执行完初始化之后,在把它修改回去。

      网上有由于datadir路径空间不足导致的报错,但是除非my.cnf中配置的ibdata非常大,一般在线上情况不会发生的。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values ​​to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

Where is the win10 user profile? How to set the user profile in Win10 Where is the win10 user profile? How to set the user profile in Win10 Jun 25, 2024 pm 05:55 PM

Recently, many Win10 system users want to change the user profile, but they don’t know how to do it. This article will show you how to set the user profile in Win10 system! How to set up user profile in Win10 1. First, press the "Win+I" keys to open the settings interface, and click to enter the "System" settings. 2. Then, in the opened interface, click "About" on the left, then find and click "Advanced System Settings". 3. Then, in the pop-up window, switch to the "" option bar and click "User Configuration" below.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

See all articles