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 requires MySQL (MariaDB) accounts for a course (such as CIS550), CETS will provision accounts to students currently enrolled in these courses 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 account. 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
before you can connect to your database.
How do I connect to MySQL?
Once you've created your MySQL database, log onto
eniac.seas.upenn.edu and connect to your database by typing the following at the
mysql -p -u DBUSERNAME -h DBSERVER DBNAME
- Replace DBUSERNAME with your own mysql username. This is your SEAS account username.
- Replace DBSERVER with the correct hostname, such as
- Replace DBNAME with your own mysql databasename. The name of your database is the same as your SEAS account username.
mysql -p -u jsmith -h fling.seas.upenn.edu jsmith
This will display a prompt (indicating the name of the current database) where you can type SQL commands:
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[jsmith]> select now();
Display all databases:
MariaDB[jsmith]> show databases;
View the tables in the current database:
MariaDB[jsmith]> show tables;
View the records in a table in the current database:
MariaDB[jsmith]> select * from table_name;
Create a table:
MariaDB[jsmith]> 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[jsmith]> 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[jsmith]> describe TableName;
Insert data into a table:
MariaDB[jsmith]> INSERT INTO table_name VALUES (value1, value2,....);
For example, to insert a record into the address_book table, use the following command:
MariaDB[jsmith]> INSERT INTO address_book (first_name, last_name, phone_number) VALUES ('John', 'Smith', '215-895-6955');
See the MariaDB documentation for more information.