Setting innodb_lock_wait_timeout

What is innodb_lock_wait_timeout ? In MySql innodb_lock_wait_timeout is an Innodb transaction wait time in seconds for a row lock. An another transaction has to wait for specified innodb_lock_wait_timeout if a transaction is taking place.  innodb-lock-wait-timeout in a system variable in global and session scope this variable can set dynamically to both scopes. We can set … Read more

How to create a table in MySql

MySQL is a widely used relational database management system. It is used by developers, database administrators, and data analysts to store and manage data. In this tutorial, we will discuss how to create a table in MySQL using the CREATE TABLE statement. The CREATE TABLE statement is used to create a new table in a … Read more

MySql dump using java

To take mysql database backup we have Runtime.getRuntime().exec(executeCmd). executeCmd is command that will take backup of mysql database. String executeCmd contains the mysqldump to backup database. filePath variable contains the downloaded sql file.

Give initial auto increment value while table creation

When we create a table we can give a auto increment value to a primary key filed. This field is auto incremented by one for newly inserted value. To start auto increment from specified number AUTO_INCREMENT = value is used while creating table. Example:

If you have already created a table and then want … Read more

Finding all column name of table

Suppose we have a table user and we want to fetch all its column name.For this we use INFORMATION_SCHEMA. we will use following query to fetch all column name of table

  Above query will fetch all columns of user table available in social database. Read More Setting innodb_lock_wait_timeout Set time zone in mysql … Read more

Drop command to remove a column from a table.

suppose we have a column address in table employee.

To see the description of table we use desc employee that will produce following result here we can see the description of table.

if we want to eliminate the column address from employee table then we use Drop command. Syntax:

Drop query

Read more

Date and Time

There are various pre defined function for data and time we will see them one by one. If you want to show current time then we use CURTIME().It returns time in HH:MM:SS string format

below is HHMMSS in numeric format

To select current data we use CURDATE().It returns data in YYYY-MM-DD string format. … Read more

Drop command: To eliminate a column from a table.

To eliminate a column from table we use drop command. Suppose we have table employee with an extra field Address and we want to eliminate this.

To remove this column we use Drop query. Syntax:

creating a new user in mysql

Here we are creating user with name manish and password for manish is password;

Creating a user and force user to change password at first login for that PASSWORD EXPIRE is used.

Creating a user and expiring the password after 180 days, PASSWORD EXPIRE INTERVAL 180 DAY is used

Creating a user … Read more

Changing primary key of table

We have a table basic profile with following table structure

we don’t want to use it as primary key so first we removed its auto increment the we will remove it from primary key queries for these are

If you want to make primary key to some other column than we can … Read more