Starting MySQL

From SQLZoo
Jump to navigation Jump to search

Running MySQL

Name of the server mysqld or mysqld.exe
Name of the client mysql or mysql.exe
Typical command line to start the client c:\mysql\bin\mysql -h -u scott -p gisq

the internet address of a computer running the server


the user name


the name of the database to use


forces a prompt for password

Useful commands
show tables;
describe tableX;
use databaseY;
source file.txt
Beware! Foreign keys are not enforced. Table names are case sensitive when running on Unix

The MySQL client is called mysql.

C:\>c:\mysql\bin\mysql -h -u scott -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33601 to server version: 3.23.43-log

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

use gisq
Database changed
mysql>SELECT name FROM cia;
| Western Sahara                               |
| Yemen                                        |
| Zambia                                       |
| Zimbabwe                                     |
261 rows in set (0.01 sec)

Some useful commands in MySQL:

  • show tables;
  • describe cia;