MySQL

Count of duplicate values in MySQL table

A client is using the Drupal node title module and, as part of an SEO review, I want to see how many duplicate meta titles there are.

Example usage - if a field is a varchar and you need to sort by a number. It will sort it alpabetically, instead of numerically. Type casting will convert it to an altenative data type.

Here is an example of how to select some data from a table on one database and insert into a table of a different database. I am assuming that you are using the same mysql connection.

The MySQL USE command is used to select the appropriate database at the appropriate time. database1 is where the data is being selected from and database2 is where it is inserted to.

 

Modify an existing column to make it auto increment.

Backup a database from cron. Add the following to the cron tab.

Add new user to MySQL database. First, log into the MySQL console, and then run the following command, replacing databasename, username and password.

This is the command to restore a MySQL database.

To restore it on a local computer, follow this process:
1) Open the command line (Windows, Linux or Mac)
2) cd (change directory) to the directory where the mysql.exe is located. This is likely to be in a bin directory. For example, with WAMPserver, mysql.exe is located here:
c:\wamp\bin\mysql\mysql5.0.45\bin

MySQL Server Has Gone Away Error - Cause & Solution

The MySQL Server has gone away error can happen when trying to restore a database. There are a few possible causes for this and one of the most likely is that the database is very big in size and the packet size in MySQL is not big enough.

Restore MySQL database in WampServer

If you are running WampServer on your local machine, it can be a bit tricky to restore a MySQL database. You need to do it from the Windows command line (DOS prompt), rather then the MySQL console command line. The actual MySQL restore command is slightly different to normal and you need to make sure you are in the right directory first.

Reset auto increment after deleting a table row

It is often the case that a column such as the ID column on a table will auto increment. This simply means that the next insert into the table will have an ID that is one more then the previous one and therefore all ID's will be unique.

Learn how to write custom Drupal modules

Does Drupal module development make your head explode and drive you crazy?

Why not learn from someone who has paved the way instead?

Sign up to Master Drupal 7 Module Development.

Hello!!

I am Blair Wadman and this is where I write about Drupal, PHP, CSS etc

Stuff

Syndicate

Syndicate content

© Blair Wadman
2005 - 2011