Hello guy, today we will learn how to change the database engine in the table. This video basically changing MySQL database engine InnoDB to MEMORY.
Topic: 1) How to get all database engines? 2) How to get current using a database engine? 3) How to change the database engine in the particular table? INFORMATION_SCHEMA that provides access to database metadata, information about the MySQL server such as the name of a database or table, the data type of a column, or access privileges. A storage engine is a software module that a database management system uses to create, read, update data from a database. ... There are two types of storage engines in MySQL: transactional and non-transactional. For MySQL 5.5 and later, the default storage engine is InnoDB To change the database engine of a MySQL database table, go to your phpMyAdmin available in Site Tools. ... ALTER TABLE my_table ENGINE = InnoDB; If the query is executed properly, the database engine of the table will be changed to InnoDB.<?php
//DB connection
include("DB_connection.php");
//$connect
//Get current database engine
$sql1 = $connect->query("SELECT TABLE_NAME, ENGINE
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'BIT_YT'");
echo "Current database engine:<br>";
print_r($sql1->fetch_array(MYSQLI_ASSOC));
echo "<br>";
//Change database engine
$sql2 = $connect->query("ALTER TABLE students ENGINE = MEMORY");
echo "Changing DB engine<br>";
//Re-check current database engine
$sql3 = $connect->query("SELECT TABLE_NAME, ENGINE
FROM information_schema.tables
WHERE TABLE_SCHEMA = 'BIT_YT'");
echo "Current database engine (NEW):<br>";
print_r($sql3->fetch_array(MYSQLI_ASSOC));
echo "<br>";
Comments
Post a Comment