Difference between revisions of "MySQL"

From DUNE
Jump to navigation Jump to search
(Created page with "=Install= <pre> sudo apt-get update sudo apt-get install mysql-server </pre> =The Service= <pre> systemctl status mysql.service mysqladmin -p -u root version mysql -u root -p...")
 
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
 
mysqladmin -p -u root version
 
mysqladmin -p -u root version
 
mysql -u root -p
 
mysql -u root -p
 +
</pre>
 +
 +
=CLI Client Commands=
 +
==Misc==
 +
<pre>
 +
quit
 +
\q
 +
SELECT VERSION();
 +
select (4+11);
 +
</pre>
 +
 +
==Admin==
 +
<pre>
 +
SHOW DATABASES;
 +
use FOO;
 +
create table t1 (name varchar(20), ts DATE);
 +
describe t1;
 +
</pre>
 +
 +
=Dump/Restore=
 +
<pre>
 +
mysqldump  eicugorg_eic_drupal -u eicugorg_drpbkp -p > eicugorg_eic_drupal_20190225.sql
 +
mysql -u eicugorg_drpbkp -p eicugorg_eic_drupal < eicugorg_eic_drupal_20190225.sql
 
</pre>
 
</pre>

Latest revision as of 01:30, 26 February 2019

Install

sudo apt-get update
sudo apt-get install mysql-server

The Service

systemctl status mysql.service
mysqladmin -p -u root version
mysql -u root -p

CLI Client Commands

Misc

quit
\q
SELECT VERSION();
select (4+11);

Admin

SHOW DATABASES;
use FOO;
create table t1 (name varchar(20), ts DATE);
describe t1;

Dump/Restore

mysqldump  eicugorg_eic_drupal -u eicugorg_drpbkp -p > eicugorg_eic_drupal_20190225.sql
mysql -u eicugorg_drpbkp -p eicugorg_eic_drupal < eicugorg_eic_drupal_20190225.sql