Mysql modifies the database's storage engine (InnoDB), mysqlinnodb

Source: Internet
Author: User
Tags mysql code

Mysql modifies the database's storage engine (InnoDB), mysqlinnodb
The current example is to change the engine MyISAM to innodb.

View the supported database engines and default database engines of the current database


Database-supported engines and default database engine code
Show engines;


Change Method 1: modify the configuration file my. cnf

Open my. cnf, add "default-storage-engine = InnoDB" at the end of [mysqld], restart the Database Service, and change the default database engine to InnoDB.


Method 2: specify or modify the table when creating the table

Mysql code
-- Specify
Create table mytbl (
Id int primary key,
Name varchar (50)
) Type = InnoDB;

-- Modify the table after the table is created
Alter table mytbl2 type = InnoDB;


-- View the Modification result (mytest is the name of the database where the table is located)
Show table status from mytest;

Use commands to view the storage engine
Mysql> show variables like '% storage_engine %'; you need to check the engine used by a table (the storage engine used for the table is displayed after the parameter engine in the display result ):
Mysql> show create table name;
How to set the storage engine in mysql? How can I change INNODB to MYISAM? How can I save databases, tables, and other objects in MYSQL in DOS?

1. How do I set the storage engine in mysql? ------------ The default value is myisam, which is also specified during table creation. For example, create table test (id int) engine = innodb;
2. How can I change INNODB to MYISAM? ------------------ Alter table test engine = myisam;
3. How to save databases, tables, and other objects in MYSQL in DOS? ----------------- Execute create database databasename; create table test (id int) in dos. In this way, the database and table are generated. The corresponding system file is under data in the mysql installation directory, the database name corresponds to a folder. For example, if you create database testdb, you can find the testdb directory under the data Directory. For objects such as tables, you need to check the specific engine. For myisam engine, there will be three files, test. frm, test. myi, test. there are three myd, and innodb only has one test. frm structure files, data and index files are all in the ibdata1 tablespace.
4. How does PHP connect to MYSQL? Do you have to enter the code? Is there any other simple method, such as UI-based setting -----------------. You need to write the connection information and I have found a php connection to mysql online. For details, refer
<? Php
$ Mysql_server_name = 'localhost'; // change it to your mysql database server.
$ Mysql_username = 'root'; // change the username of your mysql database.
$ Mysql_password = '000000'; // change the password of your mysql database.
$ Mysql_database = 'mydb'; // change the name of your mysql database.

$ Conn = mysql_connect ($ mysql_server_name, $ mysql_username, $ mysql_password, $ mysql_database); // explain down from the beginning of this sentence

$ SQL = 'insert into book (name, pwd) values ("ggg", "ggg ");';
// This is an SQL statement: Insert a record into the book table

Mysql_query ($ SQL );
// Execute the SQL statement

Mysql_select_db ($ mysql_database, $ conn); // select the database where the above table is located (this statement should be executed before the above sentence)

$ Result = mysql_query ($ SQL); // This sentence is completely redundant. It is the same as the one above!

Mysql_close ($ conn); // close the database connection
Echo "Hello! Operation successful! "; // Display prompt information

?>

Urgent: the MySQL database storage engine created between me is Innodb. How can I convert the storage engine to MYISAM?

Alter table 'tablename' ENGINE = MYISAM

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.