Faircube Networks - Custom programming projects, internet consulting, web design, and various other multimedia and graphic design solutions.
 
Home arrow MySQL arrow Connecting to MySQL database and issuing Grant statement
Connecting to MySQL database and issuing Grant statement

Connecting to a MySQL server requires a username and password. You can also specify the name of the host where the server is running. If you don't specify connection parameters explicitly, mysql assumes default values. For example, if you specify no hostname, mysql typically assumes the server is running on the local host.

The following example shows how to use the mysql program to connect to the server and issue a GRANT statement that sets up a user account with privileges for accessing a database named mydb. The arguments to mysql include -h localhost to connect to the MySQL server running on the local host, -p to tell mysql to prompt for a password, and -u root to connect as the MySQL root user.

% mysql -h localhost -p -u root

Enter password: ******

mysql> GRANT ALL ON mydb.* TO 'myuser'@'localhost' IDENTIFIED BY

'mypass';

Query OK, 0 rows affected (0.09 sec)

mysql> QUIT

 
 
Home | Services | Portfolio | Support | Prices | About Us | Privacy | Terms | Website Resources | Legal
Copyright © 1999-2007 Faircube Networks Inc. All Rights Reserved.