MySQL 5.6默认存储引擎是MyISAM而不是InnoDB

Ant*_*ony 5 mysql innodb systemd centos7

我是新来的,我希望有人能帮助我解决MySQL问题.

在这里我有一个奇怪的情况,InnoDB不是默认的存储引擎:

  • MySQL版本14.14 Distrib 5.6.39,适用于Linux(x86_64),使用EditLine包装器.
  • linux发行版:CentOS Linux发行版7.5.1804(酷睿)

我已经尝试了几乎所有的解决方案,使InnoDB成为默认引擎,但它确实对我有用.

以下是我尝试过的一些事情:

步骤1

files my.cnf and my.ini. has been edited in /root/my.cnf and /root/my.ini and /etc/my.cnf as:

[mysqld]
character-set-server=utf8
collation-server=utf8_bin
default-storage-engine=INNODB
max_allowed_packet=256M
innodb_log_file_size=2GB
transaction-isolation=READ-COMMITTED
binlog_format=row
Run Code Online (Sandbox Code Playgroud)

保存文件后的第2步我确实以几种方式重启了MySQL:

Following commands DID NOT work:

# /etc/init.d/mysqld stop:  No such file or directory  
# /etc/init.d/mysql stop:  No such file or directory 
# service mysqld stop
Redirecting to /bin/systemctl start mysql.service
Failed to start mysqld.service: Unit not found.

Following commands DID work:

# service mysql stop
Redirecting to /bin/systemctl start mysql.service
# service mysql status (was Active: inactive (dead))
# service mysql start
Redirecting to /bin/systemctl start mysql.service
# service mysql status (was Active: active (running))
Run Code Online (Sandbox Code Playgroud)

第3步

 mysql> SHOW ENGINES;
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    | Engine             | Support | Comment                                                        
    | Transactions | XA   | Savepoints |
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    | FEDERATED          | NO      | Federated MySQL storage engine                                 
    | NULL         | NULL | NULL       |
    | MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          
    | NO           | NO   | NO         |
    | MyISAM             | DEFAULT | MyISAM storage engine                                          
    | NO           | NO   | NO         |
    | BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
    | CSV                | YES     | CSV storage engine                                             
    | NO           | NO   | NO         |
    | MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
    | ARCHIVE            | YES     | Archive storage engine                                         
    | NO           | NO   | NO         |
    | InnoDB             | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
    | PERFORMANCE_SCHEMA | YES     | Performance Schema                                             
    | NO           | NO   | NO         |
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    9 rows in set (0.00 sec)

    mysql>
Run Code Online (Sandbox Code Playgroud)

步骤4我尝试了以下命令,最后我将InnoDB作为DEFAULT,但是一旦你重置了mysqld它仍然没有工作cos它返回到MyISAM是DEFAULT

SET default_storage_engine=INNODB;
Run Code Online (Sandbox Code Playgroud)

这真是令人沮丧,您的帮助将受到高度赞赏

Abd*_*shi 1

可以通过执行以下步骤来实现:导航到 > phpmyadmin -> Home-> Variables -> storage engine 并将其更改为 MyISAM 为 InnoDB

看图片

在此输入图像描述