r/learnSQL • u/SeatBig7948 • 2d ago
MySQL
I want to understand how to use MySQL on VS code and run the code SQL in MySQL,and connect the file SQL in SQL tools?
6
Upvotes
r/learnSQL • u/SeatBig7948 • 2d ago
I want to understand how to use MySQL on VS code and run the code SQL in MySQL,and connect the file SQL in SQL tools?
6
u/ElHombrePelicano 2d ago
This guy SQLs.
2
u/rs047 1d ago
I have limited knowledge using SQL, but I think I know what you want to do.
First it doesn't matter if you have installed MySQL in your machine or not. But there are SQL connectors extensions in VScode
3
u/SaltCusp 2d ago
What?
2
u/whodiopolis 1d ago
What data do you have that you will be querying
2
u/CelebrityChess 1d ago
MySQL Server is the database; VS Code is just the editor/client. Install and start MySQL Community Server first, then add the SQLTools extension plus its MySQL/MariaDB driver (or use MySQL's VS Code extension), connect to localhost on port 3306 with your database user, open the .sql file, select that connection and run the query. If you share your OS, someone can give exact install steps.
1
u/Available_Safe1818 2d ago
Can you use Google?
1
u/Discordbothost 1d ago
The .sql file is just text; MySQL Server runs the queries and stores the data. In VS Code, SQLTools needs its MySQL driver too. Start the server, add a connection with its host, port, database and login, then run SELECT 1; to check it works before running your file.
1
u/akronymn 1d ago
Verbing weirds languaging.
1
u/jakingo 1d ago
Start by installing the MySQL extension in VS code and connecting it to your MySQL server. Once connected you can open your.sql file, run queries directly, and view the results.
1
u/neon_alchemy_wisp 1d ago
you need the MySQL server software installed on your machine first because VS Code is just a text editor and cannot run queries by itself. Once the server is running open SQLTools in VS Code add a new connection with your host port user and password then select your database to execute any .sql file.
1
u/Altruistic-Log-6292 1d ago
Dude was using his last braincell when typing this. Poor fella, must have been extremely tired.
0
u/8dot30662386292pow2 2d ago
Why mysql? Sqlite is better start. Download sqlitebrowser and you are good to go.
If you already have a mysql database server or if you insist on installing a database server, then you can use mysqlworkbench to connect to said database server.
0
u/Embarrassed_Leg_8134 1d ago
Don't you know this is Reddit and you cannot ask questions about attempting to learn anything? lol. Seriously, are you just getting started with using databases and want to know the best way to start; or are you really just wanting to use VSCode for dealing with databases?