Quantcast
Channel: mysql – blog.azwan.net
Browsing all 17 articles
Browse latest View live

Full mysql backup with cron job in cpanel

This is how to do daily mysql backup with cron job in cpanel. This cron job will backup your mysql database as dump file (and gzip) daily. The files will be replaced on the same day next week. Command...

View Article



Image may be NSFW.
Clik here to view.

How to backup MySQL table in phpMyAdmin

Sometimes when you are going to execute an SQL statement to your production database, you need to be very careful especially when you are using DELETE or UPDATE command. To ensure your original data...

View Article

SQL statement to list duplicate contents

You will need this SQL statement to list all duplicate contents in a table SELECT email, COUNT(email) AS NumOccurrences FROM users GROUP BY email HAVING ( COUNT(email) > 1 ) source If you want to...

View Article

Problem uploading big sql file via phpMyAdmin

I faced problem uploading a huge sql file to my shared hosting server. The size was not that big. It was only 1.8MB in size with about 30,000 records but phpMyAdmin (provided in cpanel) still failed to...

View Article

Database to convert IP to country name

Here is the link where you can download IP to country sql for database. Also come with some sample codes on how to use the data. Might be useful for your program

View Article


To update all records to upper case

If you want to update all records can use this sql statement 1 UPDATE staff SET `staff_name` = UPPER( `staff_name` )

View Article

MySQL insert into select

This SQL statement to be used to insert data into a table from another different table. 1 2 3 INSERT INTO table1 (field1) SELECT table2.field2 FROM table2 WHERE table2.field2 > 100; Be careful with...

View Article

Update with join table

To update a table with a condition within other table (to join table), you can use this statement 1 2 3 UPDATE table1 a, table2 b SET a.field6 = value WHERE a.field1 = b.field1 AND b.field2 = value2

View Article


MySQL database auto backup on windows

To backup mysql database (all databases) can use this batch file Then you can compile the .bat file to become .exe file so that the password is hidden. Download bat to exe converter from CNET download...

View Article


Reset root password for MySQL on windows

If you have problem accessing your MySQL database with this error ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: NO) You can try reset your root password with the following...

View Article

Transparent Data Encryption (TDE)

To secure the data by encryption at data at database level. This will be full done by database application and won’t affect the application level. Almost all popular RDBMS provide this feature but...

View Article

Image may be NSFW.
Clik here to view.

MySQL int type reference

 

View Article

Check value exist in a table but not in another table

SQL to check a value exist in one table but not in another. SELECT t1.name FROM table1 t1 LEFT JOIN table2 t2 ON t2.name = t1.name WHERE t2.name IS NULL or this (not tested) SELECT * FROM B WHERE NOT...

View Article


Delete records from multiple tables

This is sample query to delete record from multiple tables. Specify all joined tables to get the list but can specify records in which tables to be deleted. DELETE t1, t2 FROM t1 INNER JOIN t2 INNER...

View Article

Disable ONLY_FULL_GROUP_BY in MySQL version 5.7

To disable ONLY_FULL_GROUP_BY mode you can use the following command SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); Or can update in phpmyadmin by clicking on “Variables”...

View Article


Codeigniter bulk insert to database

If you are to insert hundreds or thousands of records, please use bulk insert. Avoid call insert query in loop. $data = array( array( 'title' => 'My title' , 'name' => 'My Name' , 'date' =>...

View Article

Truncated incorrect DECIMAL value: ”

This error message is not helpful at all. There are similar error to this for DOUBLE etc instead of DECIMAL value. I got this error when running a simple query like below in MySQL. update table_1set...

View Article

Browsing all 17 articles
Browse latest View live




Latest Images