Accessing MySQL

Your MySQL user name and password was emailed to you when you first received an account on LAMP. Please refer to your .my.cnf file if you have forgotten your password.

Table of Contents

Connecting to MySQL using phpMyAdmin

phpMyAdmin is a free software tool written in PHP intended to handle the administration of MySQL via a web browser.

To access this GUI:

  • Visit https://lamp.cse.fau.edu/phpMyAdmin (link will open a new browser window)
  • The first prompt will ask you for your FAU Username and Password
    • This password is your Canvas/Active Directory/Network Password and not the password you use for SSH or MySQL. This is the same password used to sign into computers in lab. See figure below.

    Click Image to see full size.

  • The next screen logs you into phpMyAdmin GUI. This screen requires your MySQL credentials.
    • If you forgot your user name and password to MySQL, look at the email that was sent to you or cat the .my.cnf file in your home directory.

    Click Image to see full size.

Passwordless Access through the Command Line Interface (CLI)

You should have a file already created for you in your home directory called ~/.my.cnf. Below is an example of this file:

 Example:
[code lang="bash"]
$ cat ~/.my.cnf
[client]
user="jheithof"
pass="1bEoGCs0fQjeR"
[/code]

If you don’t have this file create it using your favorite text editor and follow the format above. After you have created the file and saved your changes remember to set the proper permissions so no one else can see it.

 Example:
[code lang="bash"]
[jheithof@lamp ~]$ chmod 600 .my.cnf
[jheithof@lamp ~]$ stat .my.cnf
  File: `.my.cnf'
  Size: 46              Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 4065277     Links: 1
Access: (0600/-rw-------)  Uid: (  637/jheithof)   Gid: (  637/jheithof)
Access: 2011-08-05 21:47:30.000000000 -0400
Modify: 2011-06-07 08:42:21.000000000 -0400
Change: 2011-11-18 08:18:23.000000000 -0500
[/code]

Connecting to MySQL using CLI

Once you have logged in through SSH use the mysql command to connect to the MySQL server. If you have setup passwordless  access (see above – all new students have this setup automatically by TSG) you simply call mysql command with the name of the database you want to connect to. By default students are given a database with the same name as their login id.

 Example:
[code lang="bash"]
$ mysql jheithof
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 103504 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
+----------------------+
| Tables_in_jheithof   |
+----------------------+
| BoardPages           |
| BoardSections        |
| VisitorLocations     |
| mw_archive           |
| mw_category          |
Some rows have been taken out to safe space
| users                |
+----------------------+
42 rows in set (0.00 sec)

mysql>
[/code]

Changing Your MySQL Password

  • SSH into lamp.cse.fau.edu
  • Connect to MySQL using the command line
  • Run the SET PASSWORD command from the MySQL command line shell prompt.
  • Type exit hit enter
[code lang="bash"]
$ mysql jheithof
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 103504 to server version: 5.0.27

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET PASSWORD = PASSWORD('SXsYPSg+tH');
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[jheithof@lamp ~]$
[/code]
  • Update ~/.my.cnf using your favorite text editor

Passwordless Access through the Command Line Interface (CLI)

4 thoughts on “Accessing MySQL

  1. Roy Levow

    Note on php access to MySQL on lamp >>>>>

    MySQL on lamp can only be accessed by programs running on lamp. Furthermore, the host must be identified as “localhost” in the php mysql_connect() function call. Using “lamp.cse.fau.edu” will not work.

  2. Roy Levow

    Note on .my.cnf >>>>>

    The .my.cnf file is used only when you use the command line interface to access MySQL. When you execute the “mysql” command from the command line, mysql checks that file first for your useid and password and automatically logs you in if they are there and correct. It cannot be used to set or change your password nor does it have any effect on web or php access to MySQL.

    To work , your .my.cnf file must contain your password for MySQL. It is originally loaded with the password set on creation of the MySQL account on lamp. If you change the password as described in the article above, you must edit your .my.cnf file to contain the new password for it to continue to work.

  3. Jason Heithoff

    Jose,

    I don’t think you are connected to the correct server. It looks like your using pluto. You should try connecting to lamp.cse.fau.edu for web development. We don’t support MySQL on pluto but we do run it on lamp.cse.fau.edu. I tested your account on lamp and its working. You also have a correct .my.cnf file with your correct username and password on lamp.cse.fau.edu.

    The .my.cnf file above is just an example. It was previously my account that I was using as a way of showing students how to connect. The account no longer exists. So this is why it doesn’t work for you when you use those values. You have to modify the .my.cnf file with your username and password provided to you in your email when your account was originally setup. If you need us to change your MySQL password please send an email to help@eng.fau.edu and ask that your lamp.cse.fau.edu MySQL password be reset. But you don’t need to do this since your account is working.

Comments are closed.