Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
Can You Select Someone Else Database
Can You Select Someone Else Database? - MySQL FAQs - PHP Connections and Query Execution
✍: FYIcenter.com
If your MySQL server is provided by an Internet service company, they will provide you one database for your use only. There are many other databases on the server for other users. But your user account will have no privilege to select other databases. If you try to access other databases, you will get an error. The following tutorial exercise shows you a guest user trying to access the system "mysql" database:
<?php
$con = mysql_connect('localhost:8888', 'guest', 'pub');
if (mysql_select_db('mysql', $con)) {
print("Database mysql selected.\n");
} else {
print("Database selection failed with error:\n");
print(mysql_errno($con).": ".mysql_error($con)."\n");
}
mysql_close($con);
?>
You will get something like this:
Database selection failed with error: 1044: Access denied for user 'guest'@'%' to database 'mysql'
2007-05-10, 5056👍, 0💬
Popular Posts:
what is a service contract, operation contract and Data Contract? - part 1 In the below sample we ha...
What Is a CAPTION Tag/Element? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells A "capti...
Which JavaScript file is referenced for validating the validators at the client side ? WebUIValidati...
How To Merge Cells in a Column? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells If you ...
Why does malloc(0) return valid memory address? What's the use? malloc(0) does not return a non-NULL...