How do I get a MySQL (MariaDB) database account?

MariaDB is an enhanced, drop-in replacement for MySQL. CETS supports MariaDB for coursework or web application development.

How do I get a MySQL (MariaDB) database account for coursework?

If an instructor requests MySQL (MariaDB) for a course (such as CIS550), CETS will provision databases to students with active SEAS accounts who are currently enrolled in the course at the beginning of each semester or within 48 hours of the day of late enrollment.

Note: Please do not submit a CGI request to get a database account for courses that require one. Talk to your instructor if you are unable to access your database. Please be patient and allow 2 business days if you have just enrolled in the course after the semester has started.

How do I get a MySQL (MariaDB) database account for web application development?

CGI-enabled accounts are automatically provisioned with MySQL (MariaDB) databases for database-driven web application development. See How do I run CGI on SEAS web servers? for more information.

How do I set my MySQL database password?

Important: You must use the SEAS MySQL Account Management page to set or change your MySQL database password on fling.seas.upenn.edu or alliance.seas.upenn.edu before you can connect to your database.

How do I connect to MySQL?

After setting your MySQL password, ssh to eniac.seas.upenn.edu and connect to your database using a command in this format:

mysql -p -u dbuser -h dbserver dbname

For example:

mysql -p -u bfrankln -h fling.seas.upenn.edu bfrankln

This will display a prompt (indicating the name of the current database) where you can type SQL commands:

MariaDB[bfrankln]>

Why do I get an Access Denied error?

If you get an Access Denied error, you may be entering the password incorrectly or may not have been provisioned a MySQL account. Please try setting your MySQL password again. If that doesn't work, contact CETS.

How do I use MySQL?

Here are some basic SQL commands:

Show the current date and time:

MariaDB[bfrankln]> select now();

Display all databases:

MariaDB[bfrankln]> show databases;

View the tables in the current database:

MariaDB[bfrankln]> show tables;

View the records in a table in the current database:

MariaDB[bfrankln]> select * from table_name;

Create a table:


MariaDB[bfrankln]> CREATE TABLE table_name (
  column_name1 data_type,
  column_name2 data_type
);

For example, to create a table called address_book with three columns:

Use the following command:

MariaDB[bfrankln]> CREATE TABLE address_book (
  first_name VARCHAR(25),
  last_name VARCHAR(25),
  phone_number VARCHAR(15)
);

Display the column details of the a table:

MariaDB[bfrankln]> describe TableName;

Insert data into a table:

MariaDB[bfrankln]> INSERT INTO table_name VALUES (value1, value2,....);

For example, to insert a record into the address_book table, use the following command:

MariaDB[bfrankln]> INSERT INTO address_book (first_name, last_name, phone_number)
    VALUES ('John', 'Smith', '215-895-6955');

See the MariaDB documentation for more information.

Related Articles

© Computing and Educational Technology Services