Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

6 Sept 2011

How to set or change root password in mysql server

A very important step in a database configuration, and many times forgotten, is the setup of a root password. This easy procedure will increase the security for your databases, even if you're only using a personal server on your laptop there is always a chance for an intruder to get sensible data.



In a shell we use the mysqladmin command to achieve this as follows for a local database server:
mysqladmin -u root password "the_new_password"
 Or a remote one:
mysqladmin -u root -h host_name password "the_new_password"
Next you should restart the database server, to make sure the new security settings are used.
sudo /etc/init.d/mysql restart

20 Jan 2009

List all tables with a specific column name in MySQL

This is just a simple query which I found useful a few times to find all the tables on a database that have a specific column name.


SELECT table_name
FROM information_schema.columns
WHERE table_schema = "MY_DB_SCHEMA"
AND column_name = "THE_COLUMN_NAME";