Drop all databases in MySQL

We have many databases in our MySQL and we want to shrink/purge ibdata1 file in MySQL. How can we drop all the databases from the MySQL except information_schema and mysqld databases?

Remove Primary Key in MySQL

Without an index, maintaining an autoincrement column becomes too expensive, that’s why MySQL requires an autoincrement column to be a leftmost part of an index. You should remove the autoincrement property before dropping the key: Note that you have a composite PRIMARY KEY which covers all three columns and id is not guaranteed to be … Read more

Node.js MySQL – Error: connect ECONNREFUSED

I use Node.js server side. I tried my code on localhost and everything works fine. I bought a server and installed Apache and node.js on it and test my web application there. I correctly changed the MySQL connection configurations from localhost to the server configurations. I test my web application with this configuration: I start … Read more

MySQL: How to reset or change the MySQL root password?

Set / change / reset the MySQL root password on Ubuntu Linux. Enter the following lines in your terminal. Stop the MySQL Server: sudo /etc/init.d/mysql stop Start the mysqld configuration: sudo mysqld –skip-grant-tables & In some cases, you’ve to create the /var/run/mysqld first: Login to MySQL as root: mysql -u root mysql Replace YOURNEWPASSWORD with … Read more

MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET

As far as I can tell, both syntaxes are equivalent. The first is SQL standard, the second is MySQL’s extension. So they should be exactly equivalent performance wise. http://dev.mysql.com/doc/refman/5.6/en/insert.html says: INSERT inserts new rows into an existing table. The INSERT … VALUES and INSERT … SET forms of the statement insert rows based on explicitly … Read more

What is the meaning of sprintf(): Too few arguments

You have two %s items in the string but only one parameter supplied after the string. For each ‘%’ item in the format string it expects a matching parameter after the string to use to find in the value. like this: what you have is like: so there is no entry for the item 2 … Read more