Skip to main content
NYU is reconvening for classes in-person and remotely. Resources, information, and official updates from NYU regarding the current status of COVID-19 and its impact on the University community are available here, which includes detailed links for students, faculty and staff.
Logo of The Courant Institure of Mathematical Sciences
Courant Login
Logo of the Courant Institute of Mathematical Sciences
  • Institute
    • Mathematics external link
    • Computer Science external link
  • Academics
    • Undergraduate Programs
      • Computer Science external link
      • Mathematics external link
    • Master's Programs
      • Computer Science external link
      • Mathematics external link
      • Data Science external link
      • Scientific Computing external link
      • Information Systems external link
      • Math Finance external link
      • Computing, Entrepreneurship & Innovation external link
    • PhD Programs
      • Computer Science external link
      • Mathematics external link
      • Atmosphere Ocean Science external link
    • Prizes & Fellowships
  • Research
    • Research Areas
    • Research Centers
    • Faculty Recognition
  • People
    • Institute Leadership
    • Faculty
    • Postdocs & Research Staff
    • Graduate Students
    • Staff
    • Directory (Courant access only)
  • Calendars
    • Weekly Seminar Bulletin
    • Special Events and Activities
    • Seminars List
    • Classroom Calendar & Reservations (NYU access only)
    • NYU Academic Calendars external link
  • Resources
    • Faculty, Staff, & Students
    • Visitor Information
    • Computing & Technology
    • Courant Library
  • About Us
    • Contact Information
    • Directions
    • Newsletters
    • History of the Courant Institute
    • Employment Opportunities at Courant
  • Giving

Computing

  • Home
  • Search

User Services

  • Computer Accounts
  • Network Access
  • Mail
  • Web Hosting
  • Databases
  • Version Control
  • Storage and Backups
  • NYU IT Resources and Policies

Resources

  • Desktop Computing
  • Computer Labs
  • Compute Servers
  • Printing
  • Scanners, Copiers, and DVD Burners
  • Classroom Facilities
  • Remote Teaching
  • Frequently Asked Questions

Platforms

  • Linux
  • Windows
  • Mac

Software

  • Overview
  • Linux
  • Cybersecurity

Announcements

  • General
  • Critical

Setting up a Self-Managed MariaDB Database


Note: TheĀ Database Hosting Service is the preferred method of setting up and maintaining a database as it offers significant benefits (automatic backup, automatic restart after downtime), but it is intended for lightweight use. For research and testing purposes we reccomend using a self-managed MariaDB database.

Warning: Allowing other users read access to a MariaDB database may compromise your data integrity, always keep your data out of the public_html directory and never provide a link to it from your public_html directory.

Warning: If allowing web based content to a MariaDB database, always be aware of the SQL Injection exploits that are possible.

To create a MariaDB database on linserv1.cims.nyu.edu (for example) and access it from the CIMS network, follow the instructions below (note: if you're connecting from outside CIMS you must first ssh to access.cims.nyu.edu, and then from access.cims.nyu.edu to linserv1.cims.nyu.edu):

  1. ssh to linserv1
    ssh linserv1.cims.nyu.edu
  2. Create mariadb data directory
    [linserv1]$ mkdir -p "${HOME}/mariadb/data"
  3. Load a module for MariaDB.
    [linserv1]$ module load mariadb-11.4
    Note: other versions of MariaDB might be available using the module system.
  4. Initialize the database system.
    Note: mariadbd will not initialize the database if the directory specified by the --datadir argument is not empty.
    [linserv1]$ mariadb-install-db --no-defaults --datadir="${HOME}/mariadb/data"
  5. Start an instance of a MariaDB server on a random port between 10000 and 65535. In this example we use port 15559.
    [linserv1]$ mariadbd-safe --no-defaults --datadir="${HOME}/mariadb/data" \
    --socket="${HOME}/mariadb/socket" --port=15559 &
  6. Set the password.
    [linserv1]$ mariadb-admin --protocol=tcp --port=15559 -h localhost password
    OR
    [linserv1]$ mariadb-admin --socket="${HOME}/mariadb/socket" password
  7. Connect to mariadb server.
    [linserv1]$ mariadb --protocol=tcp --port=15559 -h localhost -p
    OR
    [linserv1]$ mariadb --socket="${HOME}/mariadb/socket" -p
  8. Create a new user, in this example, called 'New_User' with password 'newuser-password'.
    MariaDB [(none)]> CREATE USER 'New_User'@'%' IDENTIFIED BY 'newuser-password';
  9. Grant all privileges to New_User when connecting from any host.
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'New_User'@'%' WITH GRANT OPTION;
  10. Flush privileges.
    MariaDB [(none)]> FLUSH PRIVILEGES;
  11. Exit mariadb.
    MariaDB [(none)]> exit
  12. Now you can connect as newuser from any host with the following command.
    [linserv1]$ mariadb --protocol=tcp --port=15559 -u New_User -h linserv1.cims.nyu.edu -p
  13. You can shutdown the mariadb server by doing one of the following.
    [linserv1]$ mariadb-admin --protocol=tcp --port=15559 -h localhost shutdown -p
    OR
    [linserv1]$ mariadb-admin --socket="${HOME}/mariadb/socket" shutdown -p
  • New York University
  • Faculty of Arts and Science
  • College of Arts and Science
  • Graduate School of Arts and Science
  • Accessibility

Please e-mail comments or corrections to: jroznfgre@pbhenag.alh.rqh
For other inquiries, please see the list of contacts.
© New York University