Beginners guide to MySQL and MariaDB
Chapters
Installing MySQL
Downloading MySQL:
All downloads for MySQL are located at MySQL Downloads.
Downloading MariaDB
As of writing, the current version of MariaDB is version 10, you can download a copy for your operating system from this link
Installing MySQL on Linux/UNIX:
Install MySQL into Linux Centos using yum command. Below are the steps for installation of MySQL.
- Open the terminal and goto root folder.
- Type the below command using as sudo user.
sudo yum install mysql-server mysql
To install MariaDB on Centos execute the command below
sudo yum install MariaDB-server MariaDB-client
More detailed steps can be found here
Below is cut short version of output you will get after executing the above command.
Loaded plugins: fastestmirror, security
Determining fastest mirrors
epel/metalink | 14 kB 00:00
* base: mirror.san.fastserv.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: linux.mirrors.es.net
* updates: repos.lax.quadranet.com
base | 3.7
..
..
..
Complete!
Now that you have installed MySQL, we should set its service to automatically start after your system reboot with the command below
sudo chkconfig mysqld on
After executing the above command Start the Server using below command
sudo service mysqld start
sudo service mysqld stop
sudo service mysqld restart
You will see something like this if service was successfully started
Starting mysqld: [ OK ]
Now that our server is setup, its time to execute another command called
mysql_secure_installation
More about this command is available on MySQL website
Basically this commands will help you set the root password, remove unwanted anonymous users, remove test database etc.
Once you are done executing this command we are all set.
Installing MySQL on Windows:
Download .msi from MySQL Downloads page.
Once you download the MSI file, double click on the the downloaded file.
Setup wizard will kick off now and the first screen you will see is shown below
Accept the license and Click Next
Choose the setup type as Full and click Next
Here you will be shown the modules you are about to install, Click Execute
We will keep the configuration type as Development Machine as we are installing this software solely for learning purpose and will keep the default port 3306 in there.
You are able to set the root password and are able to add additional users if you wish.
We recommend to configure MySQL server as windows service and check the checkbox to start the MySQL server at System startup. Next you will get a configuration screen, click next there.
Now on the very next screen you are able to check the connectivity with your installed MySQL server,
Apply the server configuration by Clicking Execute button.
After server configuration Complete, Click on Finish button.
Select MySQL Command Line Client and Provide the same password as you did during the installation.
After the successful login, here is what it will look like
We are all set now. In the next part we will briefly show some basic queries that are helpful to admin your MySQL install
Description
In this tutorial, we will cover few topics that will give you a heads on start to build your knowledge on. Topics that we will cover briefly but still providing enough information are listed below
- Overview
- Installing on Linux and Windows
- Some useful admin queries for starters
- Connection
- Create Database
- Drop Database
- Select Database
- Data Type
- Create Table
- Drop Table
- Inserting and Selecting data
- Where Clause
- Updating and deleting data
- Like Clause
- Sorting Result
- Using Joins
- Brief introduction to Regex, Transactions and Indexes
- Alter Command
- Temporary Tables
- Database Info
- Using Sequence
- Database Export and Import
- Resetting MySQL/MariaDB Administrator password
Audience
Absolute beginners looking to get a sneak peak into what MySQL. Please remember that this is not a full on guide but a quick introduction to the subject.
Learning Objectives
Get to know MySQL and MariaDB
Author: Subject Coach
Added on: 23rd Jun 2015
You must be logged in as Student to ask a Question.
None just yet!