Setting MySQL Server in Ubuntu and RedHat

RedHat Linux

  • Download specific mysql rpm from mysql.com
  • Find out which Red Hat Version of Linux you are using with this command

    lsb_release -i -r

    and download the specific rpm file from https://dev.mysql.com/downloads/repo/yum/

  • Install the rpm using yum
  • Now, install the downloaded rpm using yum

    sudo yum localinstall downloaded_rpm_file

    The above command will create .repo file in /etc/yum.repos.d/ that will add mysql specific repositories which will be used when you in the next step

  • Install mysql-community-server
  • sudo yum install mysql-community-server
  • Start the mysql server
  • sudo service mysqld start

    Ubuntu

    1. Install mysql server and mysql client
    2. sudo apt-get install mysql-server mysql-client
    3. Set up username and password
    4. sudo mysqladmin -u root -h localhost
    5. get mysql prompt as user root
    6. mysql -u root -p