How to Fix MySQL Error – #1089 – Incorrect prefix key or the storage engine doesn’t support unique prefix keys

Today in this article we will discuss one of the most common errors of MySQL that you may face while creating tables or importing the DataBase to the new server and that is #1089 – Incorrect prefix key; the used key part isn’t a string, the used length is longer than the key part, or the storage engine doesn’t support unique prefix keys.  This occurs due to the syntax error in Create query of Database Table. If you run the below query, you may face the above error and the query will stop working and will not create a Database Table.

And, If you run the below query, you will not face any error and query will work and create …

Read More
MySQL

Reset or Change MySQL root user Password on Ubuntu Linux

Today, in this article we will discuss How you can change / Reset / Set / Update MySQL root user’s password on Ubuntu Linux Server. Sometimes while playing with root user’s privileges to allow its access remotely may change its password. Or if you have forgotten the root user’s password. Then you can not access the MySQL DB without the password. In that case, you need to change/reset it’s MySQL password. Please follow these steps to reset/change the MySQL root user password. Stop The MySQL Server

Start The MySQLd Configuration And Skip The Grant Table This will start a new MySQL Server with no-password and it will ignore the Grant table rules. Now, This Temporary MySQL Server will have full control. …

Read More
MySQL

How to execute a MySQL query and fetch its result?

Before I show you How to execute a MySQL query and fetch its result? We should know a little bit about MySQL. MySQL is an open-source relational database management system. It is very powerful database management system. MySQL has 3  main API options when considering connecting to a MySQL database server: PHP’s MySQL Extension PHP’s MySQLi Extension PHP Data Objects (PDO) MySQLi Object-oriented MySQLi is an acronym for MySQL Improved.

MySQLi Procedural

PDO PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases. Method 1: USE PDO query method

Method 2: Statements With Parameters

 

Read More
MySQL

How to create a MySQL connection?

How to create a MySQL connection? Before going ahead We’ll look an overview of MySQL. MySQL is an open-source relational database management system. It is very powerful database management system. MySQL has 3  main API options when considering connecting to a MySQL database server: PHP’s MySQL Extension PHP’s MySQLi Extension PHP Data Objects (PDO) Today in this article I’ll show you how you can create a MySQL connection in 3 different APIs. MySQL connection in PDO PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases.

MySQLi Object-Oriented connection MySQLi is an acronym for MySQL Improved.

MySQLi Procedural connection

Read More
MySQL

Basic commands of MySQL command line

Here are few commands of MySQL command line Connect to MySQL

You will prompt to enter a password if it’s localhost and password is not set for root user and just hit enter. To Show all Databases

Use or Select Database

Show Tables of Selected Database

Import SQL file to Database

Export Database to SQL file If it’s an entire DB, then:

If it’s all DBs, then:

If it’s specific tables within a DB, then:

You can even go as far as auto-compressing the output using gzip (if your DB is very big):

If you want to do this remotely and you have the access to the server in question, then …

Read More