Skip navigation

How to install or load a .sql file on SLS

2198 Views 7 Replies Latest reply: Jun 6, 2012 7:23 AM by capaho RSS
J Moore Level 1 Level 1 (50 points)
Currently Being Moderated
Jun 5, 2012 5:26 PM

My web developer has given me a .sql file to load into MySQL. I have MySQL started with a folder selected and a password set from the Server Admin. However, that is all I know how to do. How do I get thie .sql loaded into the database or do I need to create a database. Any help would be greatful. My website will not work without it.

  • capaho Level 4 Level 4 (3,650 points)
    Currently Being Moderated
    Jun 5, 2012 5:48 PM (in response to J Moore)

    You need to import the file into your mysql database.  Download the MySQLWorkbench and see if you can import the file with that.


  • capaho Level 4 Level 4 (3,650 points)
    Currently Being Moderated
    Jun 5, 2012 7:07 PM (in response to J Moore)

    If it's just a table then you would need to import it into an existing database.  If you don't have any databases you would need to create one and then import the file into it.


    mysql -u root -p database_name < import_file_name.sql


    If you use the command line, you will need to specify the full path to the import file.

  • capaho Level 4 Level 4 (3,650 points)
    Currently Being Moderated
    Jun 5, 2012 8:40 PM (in response to J Moore)

    Log into mysql:


    mysql -u root -p


    Then from the mysql command line:


    create database new_database_name;


    Then set priveleges:


    grant all on new_database_name.* to 'root'@'localhost';


    Then exit from the mysql command line and import the file as previously discussed.


    If you're not familiar with mysql commands you might want to check the documentation on

  • MrHoffman Level 6 Level 6 (11,720 points)
    Currently Being Moderated
    Jun 6, 2012 5:10 AM (in response to J Moore)



    SequelPro is a Cocoa-based Mac-style tool for MySQL.  This is a native equivalent to the MySQL Workbench stuff.  This if you're not managing the database from the command line.


    Do not install the available MySQL-related web-based management tools (eg: mysqladmin) in a web-facing directory (and certainly not unprotected against remote access) as many of the web-gremlins actively probe for the various known-weaknesses in those.  These tools have various vulnerabilities, and are widely targeted.


    MySQL is not available in Lion Server.  You'll need to manage your own MySQL installation and patches starting on OS X Server 10.7 and later, or migrate your database to SQLite or PostgreSQL.  


    Here is an example mysqldump backup and restore script.

  • capaho Level 4 Level 4 (3,650 points)
    Currently Being Moderated
    Jun 6, 2012 7:23 AM (in response to MrHoffman)

    The problem specifically is phpMyAdmin, which is fraught with security problems.  Miscreants scan for it continually, so I highly recommend against it. 


    All PHP web apps have inherent vulnerabilities, so anyone using PHP of any variety on a web server should also be using the Apache security module (modsecurity).  Unfortunately, Apple does not support modsecurity in OS X Server and installing it is a complicated process.  It's an inexcusable lapse in Apple's security philosphy.  Running a web server without modsecurity is an unacceptable risk.  Shame on Apple for such a serious omission in OS X Server security.


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.