Mysql Commands: Difference between revisions

From The Opensource Knowledgebase
Jump to navigation Jump to search
document detailing some common mysql commands. these can be used on mysql database as well as mariadb database
 
Line 13: Line 13:
=Database Management=
=Database Management=
*Create database: param  
*Create database: param  
** Using defaults
**Using defaults
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
mysql> CREATE DATABASE param;
mysql> CREATE DATABASE param;
</syntaxhighlight>
</syntaxhighlight>
** Using specific parameters. You can change the parameters based on your requirement
**Using specific parameters. You can change the parameters based on your requirement
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
mysql> CREATE DATABASE param DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
mysql> CREATE DATABASE param DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Line 25: Line 25:
mysql> DROP DATABASE param;
mysql> DROP DATABASE param;
</syntaxhighlight>
</syntaxhighlight>
=User Management=
=User Management=
=Access Rights Management=
=Access Rights Management=
=Table Management=
=Table Management=
=Backup Management=
=Backup Management=

Revision as of 12:34, 10 January 2020

Installation

  • Installation on ubuntu server through terminal
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo systemctl status mariadb
  • Start or stop mariadb server services
sudo systemctl stop mariadb
sudo systemctl start mariadb

Database Management

  • Create database: param
    • Using defaults
mysql> CREATE DATABASE param;
    • Using specific parameters. You can change the parameters based on your requirement
mysql> CREATE DATABASE param DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  • Delete database: param
mysql> DROP DATABASE param;

User Management

Access Rights Management

Table Management

Backup Management