Install and Start MySQL

Install and Start MySQL

  1. Install MySQL and configure which run levels to start on:
    sudo yum install mysql-server
    sudo /sbin/chkconfig --levels 235 mysqld on
  2. Then to start the MySQL server:
    sudo service mysqld start

    MySQL will bind to localhost ( by default. Please refer our MYSQL Remote Acess for information on connecting to your databases using SSH.


Allowing unrestricted access to MySQL on a public IP is not advised, but you may change the address it listens by modifying the bind-address parameter in /etc/my.cnf. If you decide to bind MySQL to your public IP, you should implement firewall rules that only allow connections from specific IP addresses.

Harden MySQL Server

  1. Run the scriptmysql_secure_installation to address several security concerns in a default MySQL installation.
    sudo mysql_secure_installation

You will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options. You can read more about the script in MySQL remote installation

Using MySQL

The standard tool for interacting with MySQL is the client mysqlt which installs the mysql-serverpackage. The MySQL client is used through a terminal.

Root Login

  1. To log in to MySQL as the Root User:
    mysql -u root -p
  2. When prompted, enter the root password you assigned when the mysql_secure_installation script was run.You’ll then be presented with the MySQL monitor display:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1
    Server version: 5.0.45 Source distribution
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

Leave a Reply

Your email address will not be published. Required fields are marked *