Found 4219 Articles for MySQLi

What do column flags mean in MySQL Workbench?

Ankith Reddy
Updated on 26-Jun-2020 12:38:03

3K+ Views

In MySQL Workbench, column flags can be used with a column to maintain integrity. The column flags are as follows −PK − Primary KeyNN − NOT NULLBIN − BinaryUN − UnsignedUQ − UniqueZF − Zero FilledG − Generate ColumnAI − Auto IncrementLet us learn about them one by one −PKThis stands for the primary key. It can be used to make the column as a primary key.NNIt is for NOT NULL. Used to enforce the column that it will not insert a NULL value.BINThis stands for Binary. This can be used to store data as a binary string.UNIt is for ... Read More

How to keep the connection alive in MySQL Workbench?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

688 Views

To keep connection alive in MySQL Workbench, you need to reach at the following location −Edit -> Preferences -> SQL EditorHere is the snapshot of all the options.After clicking the “Edit” menu, we will select “Workbench Preferences” as shown below −Now, select SQL Editor and set an interval. You can also set the below options to set the connection alive in MySQL Workbench.DBMS connection Keep-alive intervalDBMS connection Read-timeout intervalDBMS connection Timeout intervalHere is the screenshot

What are some good tools to visualize MySQL database schema?

George John
Updated on 30-Jul-2019 22:30:24

184 Views

There are many tools to visualize MySQL database schema. Let us see some of them −SchemaSpyThis tool is based on java and can be used to analyze the metadata of MySQL database schema. Also use it to generate a visual representation of schema. A type of command line tool.The following are the featuresSupports most JDBC compliant DBMSGenerates ER diagram for foreign keysGenerates ER diagram for implied relationships (name, type) of a column matches a primary keyGenerates ER diagram for relationships based on rails naming conventionsShows column relationship and actionsShows routinesSchemaCrawlerThis is also a tool and an API that can be ... Read More

How to take MySQL database backup using MySQL Workbench?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

412 Views

To make MySQL database backup using MySQL, first we need to install MySQL Workbench. Follow the below link to install MySQL workbench.https://dev.mysql.com/downloads/windows/installer/8.0.htmlAfter installing successfully, we need to open MySQL Workbench. Choose the option “Data Export”. Here is the snapshot.Select the database you want to export. You can also set the path here where you want to save the database.After successful completion, you can see the following screenshot.You have successfully created a backup of the above database. The following message is now visible.Export of E:\BackupDatabase has finished

How to find the MySQL data directory from command line in Windows?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

3K+ Views

To find the MySQL data directory, we can simply use the variable datadir. Let us see how to use the variable with select statement.The query is as follows −mysql> select @@datadir;Here is the output+---------------------------------------------+ | @@datadir | +---------------------------------------------+ | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ | +---------------------------------------------+ 1 row in set (0.00 sec)Now we can reach the directory from the above sample output.Here is the snapshot that displays the MySQL data directory.

Does MySQL foreign_key_checks affect the entire database?

Arjun Thakur
Updated on 26-Jun-2020 12:32:00

4K+ Views

The foreign_key_checks are session based. Now, we can say that they are for scope i.e. local or global. Here is an example demo of local or global. Both are scopes and we can set this for session.Let us set the scope −mysql> set foreign_key_checks = 0; Query OK, 0 rows affected (0.00 sec) mysql> set global foreign_key_checks = 0; Query OK, 0 rows affected (0.05 sec)The foreign_key_checks variables are server system variables. Here are some more details −PropertyValueSystem Variableforeign_key_checksScopeGlobal, SessionDynamicYesTypeBooleanDefault ValueONSetting foreign_key_checks to 0It affects data definition statements: DROP SCHEMA drops a schema even if it contains tables that have ... Read More

How to conduct an Accent Sensitive search in MySQL?

George John
Updated on 30-Jul-2019 22:30:24

207 Views

To conduct an Accent sensitive search in MySQL, we can use collation with utf8_bin. Here is the syntax to conduct accent sensitive search −yourColumName dataType collate utf8_bin;Apply the above syntax to conduct accent sensitive search. First, let us create a table −mysql> create table AccentSearchDemo -> ( -> Id varchar(100) collate utf8_bin -> ); Query OK, 0 rows affected (0.51 sec)Inserting three records into the table −mysql> insert into AccentSearchDemo values('John123'); Query OK, 1 row affected (0.31 sec) mysql> insert into AccentSearchDemo values('Smith123'); Query OK, 1 row affected (0.15 sec) mysql> ... Read More

How can I merge two MySQL tables?

Chandu yadav
Updated on 30-Jul-2019 22:30:24

4K+ Views

To merge two MySQL tables, use the following syntax −INSERT IGNORE INTO yourTableName1 select *from yourTableName2;We will create two tables with some records. After that the merge process will begin using the above syntax.Creating first table −mysql> create table MergeDemo1 -> ( -> id int, -> primary key(id), -> Name varchar(200) -> ); Query OK, 0 rows affected (1.00 sec)Inserting records into the table −mysql> insert into MergeDemo1 values(1, 'John'); Query OK, 1 row affected (0.21 sec)Displaying records from the tablemysql> select *from MergeDemo1;The following ... Read More

How can we use nested transactions in MySQL?

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

2K+ Views

We can work with nested transactions in MySQL with the help of SAVEPOINT.Firstly, create a table. After that, begin the transaction.Now, insert records in the table created above. Use SAVEPOINT statement to set a named transaction savepoint with a name of identifier.Here are all the steps shown in the form of query −Create tablemysql> create table NestedTransactionDemo -> ( -> Name varchar(200) -> ); Query OK, 0 rows affected (0.63 sec)Start the transaction −mysql> START TRANSACTION; Query OK, 0 rows affected (0.00 sec)Now, insert a record in the tablemysql> insert into ... Read More

How to Auto Generate Database Diagram in MySQL?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

397 Views

To auto generate database diagram in MySQL, use MySQL workbench. For this, select the option from database as shown below −Database->Reverse EngineerHere is the snapshot showing the Database tab −After clicking “Database” above, choose the option “Reverse Engineer”. This state the “Reverse Engineer” mode.Clicking above will display the following table automatically. We had one table in the database “business”. The same table “tblstudent” is visible here −

Advertisements