Project 1 - 3 Download and Install MySQL on Linux


Project 1 “3 Download and Install MySQL on Linux

In this project, you will download MySQL, install it, and set a password. Depending on whether or not your Linux computer is set up to use a graphical interface ( startx ), you may use a Linux browser to download the necessary files, transfer the files using a file transfer program (FTP) to a MySQL mirror site ( ftp < close-ftp-site-from-list-on-MySQL-site >), or use a browser on a Windows machine and an FTP to place them on your Linux machine.

Note  

The screen captures for the Linux- related projects were taken by using a Windows-based program to view the Linux command line. Therefore, the window s appearance will differ slightly from that of a Linux-based one, but the command-line view is the same.

Step by Step

  1. Open a browser and go to http://www.mysql.com/downloads/index.html.

  2. Scroll down to MySQL database server & standard clients and click the link for the (highest numbered) MySQL x.x -- Production release (recommended) .

  3. Scroll down to the box labeled Linux RPM downloads .

  4. Download the appropriate (for most users, Linux x86 RPM downloads) Server and Client Program RPMs to /usr/local/src.

  5. From the /usr/local/src directory, you can install both the Server and Client packages at the same time with the following the RPM command:

     rpm -i <  server filename  > <  client filename  > 

    Alternatively, you can install them separately with the following two commands, which check to see if there are previous versions already installed, and if so, upgrades instead of running a full installation:

     rpm -Uvh <  server filename  > rpm -Uvh <  client filename  > 
  6. To verify that MySQL is installed and running, enter the following command:

     mysqladmin -p ping 

    If MySQL is running, it will return the message mysql is alive . If not, it will return an error message.

  7. As the screen showed when you ran the rpm command to install MySQL, there is no password on the database on initial startup. For security, it is important to set a password for the root MySQL user now by entering the following two commands, one at a time. The first command sets the root password as pa55w0rd (you should type your own chosen password in place of pa55w0rd ). The second line sets the password of root@localhost ( `hostname` determines the localhost name and places it in the mysqladmin command).

    Note  

    Make sure to use the backtick to surround the word hostname rather than the single quotation mark. The backtick ( ` ) is usually located in the upper-left corner of the keyboard, with the tilde (~) as its shifted symbol.

     /usr/bin/mysqladmin -u root PASSWORD pa55w0rd /usr/bin/mysqladmin -u root -h `hostname` PASSWORD pa55w0rd 
  8. Type mysql -p and press ENTER . The password prompt will come up.

  9. Type your password and press ENTER . The prompt will change from the localhost/directory prompt to the mysql prompt.

Project Summary

You now have all the necessary software installed on Linux to proceed to the rest of the projects. Your computer has two default databases installed: mysql and test . MySQL has created a my.cnf file with default settings for you in the /etc directory. For information about why you might change from those defaults, see the Ask the Expert section that preceded Critical Skill 1.5.




MySQL(c) Essential Skills
MySQL: Essential Skills
ISBN: 0072255137
EAN: 2147483647
Year: 2006
Pages: 109

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net