[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"howto:sql:mac:en":3},{"resolvedFromAlias":4,"canonicalExt":5,"ext":5,"name":6,"category":7,"categoryName":8,"updatedAt":9,"os":10,"osLabel":11,"quickSolution":12,"stepByStep":13,"recommendedSoftware":17,"alternativeMethods":18,"commonIssues":19,"securityNote":38,"extensionPath":39,"extensionLabel":40,"breadcrumbs":41,"metaDescription":51},false,"sql","SQL script (Structured Query Language)","code","Code","2026-06-12T09:08:10.411Z","mac","Mac","To open .SQL files on Mac, to view/edit: Open the .sql file with a plain-text editor (for example, TextEdit in plain-text mode).",[14,15,16],"To view/edit: Open the .sql file with a plain-text editor (for example, TextEdit in plain-text mode).","To execute in PostgreSQL: use Terminal with psql and run the script using psql’s file execution features (see the PostgreSQL psql documentation).","To execute in MySQL: run it from the MySQL command-line client or open and execute it in MySQL Workbench (per the MySQL tutorial source).",[],[],[20,26,32],{"title":21,"description":22,"steps":23},"Double-clicking opens the file in the wrong program",".sql is plain text, so the OS may associate it with an unexpected editor or a database tool you don’t want to use for viewing.",[24,25],"Use “Open with” to choose your preferred text editor for reading/editing.","If you need to run it, open your database client (for example psql) and execute the script from there instead of double-clicking.",{"title":27,"description":28,"steps":29},"Script runs but fails with syntax errors","SQL syntax and supported features can vary between database systems, so a script generated for one product may not run unchanged on another.",[30,31],"Confirm which database the script targets (for example PostgreSQL vs MySQL) and run it using the matching client/tool (psql for PostgreSQL; MySQL CLI/Workbench for MySQL).","If you must run it on a different database, edit the SQL to match that database’s dialect and features, then try again.",{"title":33,"description":34,"steps":35},"Import/execute fails due to missing database connection or permissions","Executing a .sql file requires connecting to the right server/database and having privileges to create/alter objects or modify data.",[36,37],"Verify you are connecting to the intended database instance and database name in your client (for example in psql connection options).","Ask for or grant the required permissions before re-running the script.",".sql files can contain destructive statements (for example dropping tables or deleting data). Read the script in a text editor before executing it, especially if it came from an untrusted source.","/file-extension/sql",".SQL",[42,45,48],{"label":43,"to":44},"Home","/",{"label":46,"to":47},"How To","/file-extension",{"label":49,"to":50},"Open .SQL on Mac","/how-to/open-sql-on-mac","Learn how to open .SQL files on Mac with step-by-step instructions, recommended software, and troubleshooting tips."]