[{"data":1,"prerenderedAt":185},["ShallowReactive",2],{"extension:v3:en:sql":3},{"resolvedFromAlias":4,"canonicalExt":5,"ext":5,"name":6,"category":7,"categoryName":8,"updatedAt":9,"popularity":10,"summary":11,"howToOs":12,"quickAnswer":18,"answerIntro":19,"whatIs":20,"description":21,"furtherReading":22,"openInstructions":38,"commonIssues":55,"securityNotes":74,"faq":78,"aliases":91,"mimeTypes":92,"relatedExtensions":94,"breadcrumbs":142,"categoryAnchor":152,"categoryFuturePath":153,"metaDescription":154,"availableHowToOs":155,"openOnDeviceLinks":156,"cannotOpenReasons":172,"cannotOpenFixes":173,"convertOptions":174,"securityAffiliateMessaging":175,"securityAffiliates":176},false,"sql","SQL script (Structured Query Language)","code","Code","2026-06-12T09:08:10.411Z",85,".sql files contain SQL statements (queries, schema definitions, and data changes) that can be run by a database tool or opened as plain text for review and editing.",[13,14,15,16,17],"windows","mac","linux","ios","android","To open .SQL files on Windows, to view/edit: Right-click the .sql file → Open with → choose a text editor (for example, Notepad).","Open a .sql file in a text editor to read or edit it, or run it with a database client (for example PostgreSQL’s psql) to execute the SQL against a database. If you received it as a “database backup,” you typically import/run it rather than “open” it like a document.","A .sql file is usually a plain-text script containing SQL statements such as CREATE TABLE, INSERT, UPDATE, and SELECT. It is commonly used to define database schema, migrate changes, or load/export data by executing the script in a database client. The standardized media type for SQL content is application/sql (RFC 6922).","SQL (Structured Query Language) is a widely used language for managing and querying relational databases, and .sql is the common file extension for storing SQL statements as a script. In practice, a .sql file may represent anything from a single query to a full schema-and-data export meant to recreate or update a database.",[23,26,29,32,35],{"title":24,"url":25},"IANA Media Types Registry (application/sql)","https://www.iana.org/assignments/media-types/",{"title":27,"url":28},"PostgreSQL Documentation: psql","https://www.postgresql.org/docs/current/app-psql.html",{"title":30,"url":31},"How to Execute an SQL File in MySQL","https://www.mysqltutorial.org/mysql-administration/execute-sql-file-in-mysql/",{"title":33,"url":34},"SQL (Wikipedia)","https://en.wikipedia.org/wiki/SQL",{"title":36,"url":37},"freedesktop.org: shared-mime-info specification","https://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec/",{"windows":39,"macos":43,"linux":47,"ios":51,"android":53},[40,41,42],"To view/edit: Right-click the .sql file → Open with → choose a text editor (for example, Notepad).","To execute in PostgreSQL: open Command Prompt and run psql, then use psql to run the script file (see PostgreSQL psql documentation for the exact command and options).","To execute in MySQL: use the MySQL command-line client or MySQL Workbench and run/import the .sql script as shown in the MySQL tutorial source.",[44,45,46],"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).",[48,49,50],"To view/edit: open the file in a text editor (for example, a terminal editor) since .sql is plain text.","To execute in PostgreSQL: run psql from a terminal and execute the script file (see the PostgreSQL psql documentation).","On Linux desktops, file type association can use the shared MIME-info database; the file is typically mapped by extension to a MIME type such as application/sql per freedesktop.org shared-mime-info.",[52],"To read it: open the .sql file in a text viewer/editor app; for actually executing it against a database, transfer it to a desktop and use a database client such as psql or a MySQL tool.",[54],"To read it: open the .sql file in a text viewer/editor app; to run it on a real database server, execute it from a desktop database client (for example psql for PostgreSQL, or MySQL CLI/Workbench for MySQL).",[56,62,68],{"title":57,"description":58,"steps":59},"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.",[60,61],"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":63,"description":64,"steps":65},"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.",[66,67],"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":69,"description":70,"steps":71},"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.",[72,73],"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.",[75,76,77],".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.","Running a .sql script executes its commands with your database user’s privileges; use a least-privilege account when testing unfamiliar scripts.","Be cautious with scripts that include data-loading or configuration changes (users/roles/permissions) because they can alter access controls in the database.",[79,82,85,88],{"question":80,"answer":81},"Is a .sql file a database?","Usually no. It is typically a plain-text script of SQL statements that can create or modify a database when executed by a database tool.",{"question":83,"answer":84},"What is the official MIME type for .sql?","application/sql is the standardized media type registered with IANA and specified by RFC 6922.",{"question":86,"answer":87},"How do I run a .sql file in PostgreSQL?","Use PostgreSQL’s psql tool and execute the script file using psql’s script/file execution features as described in the official psql documentation.",{"question":89,"answer":90},"How do I execute a .sql file in MySQL?","Common approaches include using the MySQL command-line client or MySQL Workbench to run the script, as shown in the referenced MySQL tutorial.",[],[93],"application/sql",[95,100,106,112,118,124,130,136],{"ext":96,"name":97,"category":7,"categoryName":8,"popularity":10,"summary":98,"howToOs":99},"php","PHP script (PHP source code)",".php files typically contain PHP source code used on web servers to generate dynamic web pages and API responses. You can open them in a code editor, but they are usually executed by a web server (often via PHP-FPM) rather than “run” like a normal desktop app.",[13,14,15,16,17],{"ext":101,"name":102,"category":7,"categoryName":8,"popularity":103,"summary":104,"howToOs":105},"cs","C# source code file",80,".cs files contain C# source code used to build .NET applications and libraries. They are plain-text files typically edited in code editors and IDEs such as Visual Studio Code with C# tooling.",[13,14,15,16,17],{"ext":107,"name":108,"category":7,"categoryName":8,"popularity":109,"summary":110,"howToOs":111},"go","Go source file",78,".go files contain source code written in the Go (Golang) programming language. You can open them in code editors (for reading/editing) or build/run them with the Go toolchain.",[13,14,15,16,17],{"ext":113,"name":114,"category":7,"categoryName":8,"popularity":115,"summary":116,"howToOs":117},"tsx","TypeScript JSX (TSX) source file",75,".tsx is a TypeScript source code file that contains JSX syntax, commonly used with React-style UI components. You open it in a code editor (for viewing/editing) and build it with TypeScript tooling (for running in apps).",[13,14,15,16,17],{"ext":119,"name":120,"category":7,"categoryName":8,"popularity":121,"summary":122,"howToOs":123},"kt","Kotlin source file",72,".kt files contain Kotlin source code used to build Kotlin applications (including Android apps) and libraries. You typically open them in a code editor or IDE such as IntelliJ IDEA or Android Studio.",[13,14,15,16,17],{"ext":125,"name":126,"category":7,"categoryName":8,"popularity":127,"summary":128,"howToOs":129},"swift","Swift Source Code",70,".swift is a Swift programming language source file used to write apps and other software. You open it in code editors and IDEs such as Xcode or other text/code editors.",[13,14,15,16,17],{"ext":131,"name":132,"category":7,"categoryName":8,"popularity":133,"summary":134,"howToOs":135},"dart","Dart source code",65,".dart files contain source code written in the Dart programming language. You open them in a code editor/IDE or work with them using the Dart SDK tools.",[13,14,15,16,17],{"ext":137,"name":138,"category":7,"categoryName":8,"popularity":139,"summary":140,"howToOs":141},"proto","Protocol Buffers schema (Protocol Buffers definition file)",60,".proto files define data structures and services for Google’s Protocol Buffers. They are plain-text schemas that you open in a text editor/IDE or compile with the Protocol Buffers compiler (protoc) to generate code.",[13,14,15,16,17],[143,146,149],{"label":144,"to":145},"Home","/",{"label":147,"to":148},"File Extension Index","/file-extension",{"label":150,"to":151},".SQL","/file-extension/sql","category-code","/category/code","Learn what .SQL files are, how to open them on every platform, common fixes, and security best practices.",[13,14,15,16,17],[157,160,163,166,169],{"os":13,"label":158,"to":159},"Open .SQL on Windows","/how-to/open-sql-on-windows",{"os":14,"label":161,"to":162},"Open .SQL on Mac","/how-to/open-sql-on-mac",{"os":15,"label":164,"to":165},"Open .SQL on Linux","/how-to/open-sql-on-linux",{"os":16,"label":167,"to":168},"Open .SQL on iOS","/how-to/open-sql-on-ios",{"os":17,"label":170,"to":171},"Open .SQL on Android","/how-to/open-sql-on-android",[57,63,69],[60,61],[],"code_runtime",[177,181],{"name":178,"description":179,"affiliateUrl":180},"Avast","Avast offers free and premium antivirus software that protects against viruses, malware, ransomware, and phishing. Scan files before opening them to ensure safety.","https://www.avast.com/lp-aff-consumer-store?expid=inf601",{"name":182,"description":183,"affiliateUrl":184},"Norton","Norton 360 delivers comprehensive antivirus protection, VPN, and identity theft monitoring. Scan files for threats before opening to keep your device secure.","http://buy.norton.com/aff_home?utm_campaign=en-ww_nor_n36_aff_nas_nau_nah_cj_nad_low:_sec_nat_mktc_norton_360",1781269501165]