Create a MySQL database manually and set permissions

Because i believe in the power of the command line i usally create new MySQL databases, e.g. for my favorite CMS (content management system) Typo3, manually. Here is how it works:

Connect yourself to the MySSQL daemon with its command line interface as root user.

mysql -p root

Create the new database

create database <database-name>;

Switch over to the MySQL system database

use mysql;

Set the permissions for the database - this is one long line.

grant all privileges on <database-name>.* to <database-user>@localhost identified by "<database-password>";

Force MySQL to reload user permission settings

flush privileges;


Leave the MySQL command line interface by just typing

quit


That's all...

No comments: