MySQL - Basic Admin
This article is Part 3 in a 7-Part series called MySQL intro.
- Part 1 - MySQL - WhySQL?
- Part 2 - A pain in the MySQL!
- Part 3 - This Article
- Part 4 - MySQL - Basic Tutorial
- Part 5 - MySQL - Basic Tutorial 2
- Part 6 - MySQL - Basic Tutorial 3 - Summarise ALL the things!
- Part 7 - MySQL - Basic Tutorial 4 - SHOW TABLES becomes DB_SNAPSHOT
Managing MySQL…
Introduction
Previously, I installed MySQL for linux. Having installed MySQL on my system such that I am the admin, this post is a reference point or cheat sheet of sorts. Thus, I have included some of the basic admin commands to help me manage MySQL installation (sic).
Note: SQL is a case insensitive language, therefore select
and SELECT
are the same command!
MySQL basic usage
MySQL service control
From the installation guide, we find out how to start, stop and reset the MySQL server, and to check whether the server is running.
MySQL terminal access
1) Connecting to server
From command line: user login syntax
2) login as root (admin) mysql user:
Note: If you sudo
the following command… it could result in a vivid world of pain! This is the issue I had, but there seems to be potential fixes discussed here and here. These solutions might be suitable for a personal setting, but for production scenarios check out the instruction here (and here).
3) disconnecting
Seek help!
From this tutorial:
MySQL comments
Some interesting info about creating comments:
Cancel Command
Cancel the execution of an unexecuted console command:
Database creation and access
Some of the following commands are covered in more detail here and here. More detail will be covered in tutorials in later posts.
Show databases
Create databases
Connecting to an existing database
1) From MySQL console
2) From Shell console
Delete an existing database
More info here:
Show users
- Show all users.
- Show current user:
Create users
- creating users
Remove users
- Using this syntax.
Assign user privileges to a specific database
For more detail, see here:
Conclusion
Now that we have a basic idea of how to navigate the MySQL environment in order to administer it, let’s go onto using it to populate and utilise databases using MySQL !
This article is Part 3 in a 7-Part series called MySQL intro.
- Part 1 - MySQL - WhySQL?
- Part 2 - A pain in the MySQL!
- Part 3 - This Article
- Part 4 - MySQL - Basic Tutorial
- Part 5 - MySQL - Basic Tutorial 2
- Part 6 - MySQL - Basic Tutorial 3 - Summarise ALL the things!
- Part 7 - MySQL - Basic Tutorial 4 - SHOW TABLES becomes DB_SNAPSHOT