Need a Minecraft server? BeastNode offers the highest performance servers with DDoS protection!

Shop for plans now


How to Install a MySQL Server on your CentOS VPS

Install MySQL on your Linux Server

This guide is based on a standard install of CentOS - other distributions are not guaranteed.

To install MySQL, just run these commands:

sudo yum install mysql-server

 

sudo service mysqld start


Set the root password:

mysqladmin -u root password 'passwordhere'

In some cases you may need to use this command instead of the above to set the password (hit enter if it asks for an initial password):

mysql_secure_installation


To access the MySQL shell:

mysql -u root -p


Enter your password created as above and you'll be presented a command line with:

mysql>


Some basic MySQL commands that you can use (all commands must end with a semicolon):


Show all databases:

SHOW DATABASES;


Enter/use a database:

USE databasename;


Show tables (after you used a database):

show tables;


Create a database:

CREATE DATABASE databasename;


Delete a database:

DROP DATABASE databasename;


Exit the MySQL prompt:

\q




MySQL server management commands:


Start the MySQL server:

sudo service mysqld start


Restart the MySQL server:

sudo service mysqld restart


Stop the MySQL server:

sudo service mysqld stop

Was this answer helpful?

 Print this Article

Also Read

How To Set A Hostname For Your BeastNode VPS

To set a host name for your BeastNode VPS running on a RedHat distro (CentOS for example), just...

How to Use the VPS Serial Console

The VPS serial console allows you to access your cloud VPS server with SSH directly from the back...

How to Install and Configure an OpenVPN Server on CentOS 6

This guide will provide you with all the steps necessary to install a simple OpenVPN server on...

Installing a Minecraft Server on Your VPS

For this guide, we'll be going over how to install a Minecraft CraftBukkit server on a CentOS 5...