Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

2013-09-09

MySQL: users, passwords, CLI basics

Like PostgreSQL, MySQL has a concept of "users". In MySQL, users are stored in the mysql database in the user table. (In MySQL terms, this table can be referred to as mysql.user). One of the first things a MySQL administrator must learn to do is change MySQL user passwords. If you're a command-line kind of person (like me), and you know some SQL, the 'mysql' command is your friend.

2013-06-27

How to secure a vanilla MySQL installation

It may seem complicated, but actually it's extremely easy.

The vanilla installation has no root password, so you can do:
# mysql -u root

However, really securing the installation is more involved than simply setting a root password. To make sure "all the bases are covered" (to use a U.S. idiom), use this command:
# /usr/bin/mysql_secure_installation

This is an easy way to effect basic setup so, for example, root can login only from localhost, etc.

If you're not particularly concerned about security, you can put the root password in /etc/my.cnf -- that way, you won't have to type it manually.