User Tools

Site Tools


programming:mysql:mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming:mysql:mysql [2017/11/24 15:00] – [Mysql timezone] mferreiraprogramming:mysql:mysql [2019/10/11 09:34] (current) – [Export database] maferreira
Line 4: Line 4:
   Enter password:    Enter password: 
  
-  mysql> create database myDatabase;+===== Export database ===== 
 +With data: 
 +<code mysql>mysqldump -u YourUser -p YourDatabaseName > wantedsqlfile.sql</code> 
 +Without data: 
 +<code mysql>mysqldump --no-data -u YourUser -p YourDatabaseName > wantedsqlfile.sql</code> 
 +===== Import database ===== 
 +<code mysql>mysql -u username -p database_name < file.sql</code> 
 +<note important>Make sure you have created an empty database named <data_basename></note> 
 + 
 +<code mysql>mysql> CREATE DATABASE <myDatabase>;</code>
   Query OK, 1 row affected (0.01 sec)   Query OK, 1 row affected (0.01 sec)
 +
 +===== Create user =====
 +<code mysql>CREATE USER '<username>'@'localhost' IDENTIFIED BY '<password>';</code>
  
   mysql> grant usage on *.* to myUsername@localhost identified by 'myPassword';   mysql> grant usage on *.* to myUsername@localhost identified by 'myPassword';
programming/mysql/mysql.1511535656.txt.gz · Last modified: 2017/11/24 15:00 by mferreira