The first two lines below are equivalent, but use the third if you plan to
load a data file from the mysql
command line after login, and the last
if you also want to see details of any warnings that you might get.
$ mysql -p $ mysql -p -u uxx $ mysql -p -u uxx --local-infile uxx $ mysql -p -u uxx --local-infile uxx --show-warnings
mysql> exit mysql> quit mysql> Ctrl + D
mysql> \! ls [for example]
mysql> SOURCE filename.sql;
mysql> SHOW DATABASES;
mysql> USE database_name [semicolon optional]
mysql> LOAD DATA LOCAL INFILE 'name.ext' INTO TABLE table_name; (TAB field separator assumed) mysql> LOAD DATA LOCAL INFILE 'name.ext' INTO TABLE table_name FIELDS TERMINATED BY ',';
mysql> SHOW TABLES;
mysql> DESCRIBE table_name;
mysql> SELECT * FROM table_name; mysql> SELECT * FROM table_name \G [for a more readable vertical format] mysql> PAGER less [semicolon optional; to see select output one page at a time]
mysql> SELECT * FROM table_name WHERE condition(s);
mysql> SELECT column_name1 [, ...] FROM table_name1 WHERE condition(s);
mysql> UPDATE table_name SET column_name1=value1 [, ...] WHERE column_name=value;
mysql> DELETE FROM table_name WHERE condition(s);
mysql> DELETE FROM table_name;
mysql> DROP TABLE table_name;
mysql> ALTER TABLE table_name auto_increment=1; [for example]
mysql> RENAME TABLE old_name TO new_name;
mysql> SOURCE filename.sql;
The above command works OK if filename.sql is creating a
table, but if filename.sql is loading data
from an
external
(local) file into an existing table, the command will generate an error
unless you have
logged into mysql with the following longer-form login
command:
$ mysql -p -u uxx --local-infile uxx
$ mysql -p -u uxx < filename.sql;
The above command works OK if filename.sql is creating a
table, but if filename.sql is loading data
from an
external (local) file into an existing table, the corresponding
command should look like this:
$ mysql -p -u uxx --local-infile uxx < filename.sql;
ps.cs-smu.ca/phpmyadmin