mysql add user

ares# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 64
Server version: tha_duh_version_0.1

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>create database foo_db;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on foo_db.* to foo_db_user;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for foo_db_user = password('foo_db_user_passwd');
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

To see all granted privileges for a user easily.
mysql> show grants for foo_db_user;
| Grants for foo_db_user@%                                                                                   |
| GRANT USAGE ON *.* TO 'foo_db_user'@'%' IDENTIFIED BY PASSWORD '*6C0EECAB4C3A82BB5678B5915C318891D2264AAD' |
| GRANT ALL PRIVILEGES ON `foo_db`.* TO 'foo_db_user'@'%'                                                    |
2 rows in set (0.00 sec)

mysql> quit

To enable remote logins for the foo_db_user
grant all on foo_db.* to 'foo_db_user'@'' IDENTIFIED BY 'password';

where is the IP address that foo_db_user connects from. You may use % if you need to allow access to foo_db_user from everywhere.

some φ@\<3n5td hm! thorough ref mysql add users

mysql add user

apache2 - mysql - phpmyadmin - debianise

I assume you are running apache2 already

Install mysql-server
#apt-get install mysql-server
set the root password on the ncurses menu

#apt-get install phpmyadmin
select apache2
skip the config-db crap

To set the password for the phpmyadmin setup
#cd /etc/phpmyadmin
#htpasswd -b ./htpasswd.setup admin password
Please use a descent password instead of password.

If apache2 is setup with virtual hosts and you do not want phpmyadmin to be accessible from every virtual host eg move phpmyadmin.conf off /etc/apache2/conf.d

If not, you are done and you can login at or and access the phpmyadmin setup at or

To setup phpmyadmin using the web interface
  1. login at with 'admin' and 'password'
  2. make the phpmyadmin/ group writable ... just run
  3. Set whatever you want to set through the web interface
  4. Secure the phpmyadmin/ again ... just run

So, to enable phpmyadmin for just one virtual host.
#cd /etc/apache2/conf.d/
#rm phpmyadmin.conf 
#/etc/init.d/apache2 restart
Now enable phpmyadmin for the virtual host by adding
Include /etc/phpmyadmin/apache.conf
to the virtual host configuration file eg
#echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/sites-available/
#/etc/init.d/apache2 reload

phpmyadmin debian ubuntu