Syed Jahanzaib Personal Blog to Share Knowledge !

November 14, 2009

MYSQL: Howto create new Database Entry!

Filed under: General IT Related, Linux Related, Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 6:35 AM

On a default settings, mysql root user do not need a password to authenticate from localhost. In this case, ou can login as root on your mysql server using:

$ mysql -u root

If a password is required, use the extra switch -p:

$ mysql -u root -p
Enter password:

Now that you are logged in, we create a database:

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

We allow user root to connect to the server from localhost using the password 123456:

mysql> grant usage on *.* to root@localhost identified by ‘123456’;
Query OK, 0 rows affected (0.00 sec)

And finally we grant all privileges on the zaibdb database to this user:

mysql> grant all privileges on zaibdb.* to root@localhost ;
Query OK, 0 rows affected (0.00 sec)

And that’s it. You can now check that you can connect to the MySQL server using this command:

$ mysql -u root -p’123456′ zaibdb
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

Advertisements

1 Comment »

  1. […] MYSQL: Howto create new Database Entry! […]

    Like

    Pingback by surambili — December 12, 2013 @ 4:39 AM


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: