Tuesday 17 July 2018

mysql Options

mysql Options
      

mysql -user root -password -host uranus -default-character-set=utf8 mylibrary

Processing SQL Files with mysql
      


mysql [options] databasename < file.sql
Change default-character-set for backup
      

mysql -u root -p -default-character-set=latin1 name < backup.sql

Connect to the mysql database as the root user from the MySQL CLI
       

mysql -u root -p mysql
Connects the root account to the inventory database:
       

mysql -u root -p inventory
If you dumped tables from a single database, you'll need to tell mysql which database to import them into
        

% mysql db_name < dump.txt
Connect to the MySQL database as root
       

% mysql -u root mysql
Import a SQL-format dump file back into MySQL
        

% mysql < dump.txt
mysql Commands
      

Abbreviation            Command              Interpretation
\c                      clear                terminates input of command.
\h                      help                 displays a list of commands.
\q                      exit or quit         ends mysql. 
\s                      status               shows status information on the MySQL server.
\T [f]                  tee [filename]       logs all input and output into the specified file.
\t                      notee                ends tee. 
\u db                   use database         makes the specified database the default.
\. fn                   source filename      executes the SQL commands contained in the given file.




0 comments:

Post a Comment