Create new mysql database and new user
There are two ways to create a new database in mysql. You can use mysql command if you have access to the command line or you can use graphical user interface tools. Here are examples on how to create a new database in mysql using command line and gui tools:
Create a new database using mysql command
1) Login into mysql as root.
root@kkcjlab-server:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.0.75-0ubuntu10.5 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
|
2) Create a new database using mysql 'create database' command.
mysql> create database newdb;
Query OK, 1 row affected (0.00 sec)
|
That's it. Now you have a new database created for root user. If you want to use other user than root to manage the database, then you can create a new user and assign privileges to the database. Here is the steps:
1) Login into mysql as root.
2) Create user as well as grant privileges.
mysql> GRANT ALL PRIVILEGES ON *.* TO 'drupal'@'localhost' IDENTIFIED BY 'passwd1';
Query OK, 0 rows affected (0.00 sec)
|
Create a new database using phpmyadmin
You must have PHPMYADMIN installed in your system before performing these steps. Here are steps to create a new database using phpmyadmin:
Open web browser. Type localhost/phpmyadmin in the url and press enter.
Login using the database admin user and key in the correct password.
Create a new database.
Add new user and assign privileges for the new user to manage database.
1) Click Privilege menu.
2) Click Add a new user link to add a new user for mysql database.
3) Fill login information for a new mysql database user account.
4) Set privileges for the new mysql database user.
5) Set specific privileges for the new mysql database user if you want.
6) Select specific privileges for the new mysql database user.
That's all. Now you have a new database and a new user with specific privileges to manage the database.
Popular content
Today's:
- Linux scp command - copy file and directory from remote computer
- How to mount and unmount usb drive or thumb drive in Linux
- Linux vi editor tutorial - Create and edit file in command line terminal
- Linux fdisk command - check hard disk partitions
- Linux network - Install and configure proftpd in Ubuntu Server

Great post. I find that your
Great post.
I find that your guides are easy to learn and implement.
One thing to mention tough is that in Cpanels and other hosting control panels have an easy wizard to make a new database, user and assign the user to the database with the proper privileges.