This part is a supplement to the previous article . Regarding how to add MySQL to the Visual Studio Service Explorer for simple logging. The tool that needs to be installed is mysql-for-visualstudio.
Why use mysql-for-visualstudio
When programming with Visual Studio, open the Server Explorer and the data connection option will appear.
If you right-click the data connection => Add connection, there is no MySQL database option, only the Microsoft family database. You need to install one at this time, and you mysql-for-visualstudio
can add the MySQL database.
I've already installed it here, so I'll cover it up.
Install mysql-for-visualstudio
This tool mysql-for-visualstudio
can be downloaded from the official website. Here is the address:
https://downloads.mysql.com/archives/visualstudio/
Download interface: There is MySQL for Visual Studio
Of course, you can also MySQLInstaller
download and install it in . But if you are like me and your installer cannot install it, it may be a version problem. You can only download and install it from the web page.
I can't install it here. I need to download and install it from the official address mysql-for-visualstudio above .
v1.2.6 cannot support 2019
In addition, pay attention to version issues!
If your VS is 2019 and above, be sure to download and install MySQL for Visual Studio 1.2.9 and above.
For details, please read the official document 1 :
After downloading, double-click the msi file and install it by default. The file is not large, so there is no need to consider changing the path.
Then, when you open your installer, there will be mysql-for-visualstudio
, which means the installation is successful.
Add MySQL in VS Service Explorer
At this time, you open yours Visual Studio
and you can add MySQL.
Enter and connect as required.
The input here is the same as Navicat connecting to MySQL.
(It is the same as the parameters passed when creating a database connection Object in writing a program)
After adding it, you can use VS to open and design the database table.
Take the database table I created as an test
example student
:
Here, you can manually design database tables and test SQL statements.
This graphical interface is very similar to Navicat.
https://dev.mysql.com/doc/visual-studio/en/visual-studio-install.html ↩︎