Thursday, June 18, 2009

MySQL Installing DB and setting password

Before starting server, you need to install database to use.

./mysql_install_db --datadir=<path where db is installed> --user=<dbuser>

Now, you can start server.

./bin/mysqld_safe --user=<user> --port=<dbport> --socket=<sockfile path> --datadir=<path where db is installed> &

As a default, root user can login without password on console. This should be changed.

mysql> delete from mysql.user where user = '' ; # disable anonymous login
mysql> set password for 'root'@'localhost' = password('<root password>'); # set root password

No comments:

Post a Comment