11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoCHAPTER 28 • MYSQL STORAGE ENGINES AND DATA TYPESViewing DatabasesIt’s often useful to retrieve a list of databases located on the server. To do so, execute the SHOW DATABASEScommand:mysql>SHOW DATABASES;+--------------------------------+| Database |+--------------------------------+| information_schema || book || corporate || mysql || test || wikidb |+--------------------------------+6 rows in set (0.57 sec)Keep in mind that your ability to view all the available databases on a given server is affected by userprivileges. See Chapter 29 for more information about this matter.Note that using the SHOW DATABASES command is the standard methodology prior to <strong>MySQL</strong> version5.0.0. Although the command is still available for versions 5.0.0 and greater, consider using thecommands provided to you by way of the INFORMATION_SCHEMA. See the later section titled “TheINFORMATION_SCHEMA” for more information about this new feature.Creating a DatabaseThere are two common ways to create a database. Perhaps the easiest is to create it using the CREATEDATABASE command from within the mysql client:mysql>CREATE DATABASE company;Query OK, 1 row affected (0.00 sec)You can also create a database via the mysqladmin client:%>mysqladmin -u root -p create companyEnter password:%>Common problems for failed database creation include insufficient or incorrect permissions, or anattempt to create a database that already exists.547

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!