WDN Logo

home-icon Home / MySQL / Installing MySQL on Linux

Installing MySQL on Linux

Installing MySQL on Linux

It’s simple to install MySQL on Linux using the RPM file.

  1. Become the superuser if you are working in your account. (Type “su” and the prompt and give the root password).
  2. Change to the directory that has the RPM download.
  3. Type the following command at the prompt:
    rpm -ivh "mysql_file_name.rpm"
    

    Similarly you can also install the MySQL client and MySQL development RPMs if you’ve downloaded them.
    Alternatively, you can install the RPMs through GnoRPM (found under System).

  4. Now we’ll set a password for the root user. Issue the following at the prompt.
    mysqladmin -u root password mysqldata
    

    where mysqldata is the password for the root. (Change this to anything you like).

  5. It is now time to test the programs. Typing the following at the prompt starts the mysql client program.
    mysql -u root -p
    

    The system asks for the the password. Type the root password (mysqldata).
    If you don’t get the prompt for password, it might be because MySQL Server is not running. To start the server, change to /etc/rc.d/init.d/ directory and issue the command ./mysql start (or mysql start depending on the value of the PATH variable on your system). Now invoke mysql client program.

  6. Once MySQL client is running, you should get the mysql> prompt. Type the following at this prompt:
    show databases;
    
  7. You should now get a display similar to:
    +----------------+
    | Database       |
    +----------------+
    | mysql          |
    | test           |
    +----------------+
    2 rows in set (0.00 sec)
    

Okay, we’ve successfully installed MySQL on your system. Now let’s look at some MySQL basics.

Sponsored Links

Search

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

joke-knock-knock-whos-there-to-to-who-no-to-whom

Sponsored Links

Tips

How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]

Fact

The App Store offers a total of 1.4 million apps as on January 8, 2015. [more...]

Share on Whats app Share on Facebook Share on Twitter Share on Google plus