MySQL Console Command

To login (from unix shell) use -h only if needed.

 

Create a database on the sql server.

 

List all databases on the sql server.

 

Switch to a database.

 

To see all the tables in the db.

 

To see database’s field formats.

 

To delete a db.

 

To delete a table.

 

Show all data in a table.

 

Returns the columns and column information pertaining to the designated table.

 

Show certain selected rows with the value “whatever”.

 

Show all records containing the name “Bob” AND the phone number ‘3444444’.

 

Show all records not containing the name “Bob” AND the phone number ‘3444444’ order by the phone_number field.

 

Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’.

 

Show all records starting with the letters ‘bob’ AND the phone number ‘3444444’ limit to records 1 through 5.

 

Use a regular expression to find records. Use “REGEXP BINARY” to force case-sensitivity. This finds any record beginning with a.

 

Show unique records.

 

Show selected records sorted in an ascending (asc) or descending (desc).

 

Return number of rows.

 

Sum column.

 

Join tables on common columns.

 

Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

 

Change a users password from unix shell.

 

Change a users password from MySQL prompt. Login as root. Set the password. Update privs.

 

Recover a MySQL root password. Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

 

Set a root password if there is on root password.

 

Update a root password.

 

Allow the user “bob” to connect to the server from localhost using the password “passwd”. Login as root. Switch to the MySQL db. Give privs. Update privs.

 

Give user privilages for a db. Login as root. Switch to the MySQL db. Grant privs. Update privs.

 

or 

 

To update info already in a table.

 

Delete a row(s) from a table.

 

Update database permissions/privilages.

 

Delete a column.

 

Add a new column to db.

 

Change column name.

 

Make a unique column so you get no dupes.

 

Make a column bigger.

 

Delete unique from table.

 

Load a CSV file into a table.

 

Dump all databases for backup. Backup file is sql commands to recreate all db’s.

 

Dump one database for backup.

 

Dump a table from a database.

 

Restore database (or database table) from backup.

 

Create Table Example 1.

 

Create Table Example 2.

 

MYSQL Statements and clauses

String Functions

Date and Time Functions

Mathematical and Aggregate Functions

Flow Control Functions

Command-Line Utilities

Perl API – using functions and methods built into the Perl DBI with MySQL

PHP API – using functions built into PHP with MySQL

Kaynak : http://www.pantz.org/

 

maxresdefault

Bir Cevap Yazın