Run SQL Server on M1/M2 Macbook
ฝัง
- เผยแพร่เมื่อ 9 ก.พ. 2023
- In this video I'll show you how you can run SQL Server on an M1 or M2 Mac. We do it using the Azure SQL Edge database and Docker.
I also show a few tips on how to check the Docker logs to help track down potential issues.
Link to Docker Hub page: hub.docker.com/_/microsoft-az...
SQL Edge configuration docs for persisting data: learn.microsoft.com/en-us/azu...
Features of SQL Edge: learn.microsoft.com/en-us/azu...
Follow me on social media!
Twitter: / scriptbytesio
Instagram: / scriptbytes
Hours of struggling with this and you helped me to finally connect to SQL! Thank you so much for the time and for sharing your knowledge !
I'm glad it helped, thanks for watching!
This is literally a lifesaver and your detailed breakdown is great. Earned a sub! Will keep coming back!
I appreciate it, thanks!
Such a great tutorial. Finally able to run MSSQL on my mac. Tried so many tutorials but yours was the one which finally made it work. Thanks
I'm glad it worked for you. Thanks for watching!
Thank you very much, you can't imagine how valuable this video has been for me.
I’m glad it helped!
My luck that I spent a couple of hours trying to figure this out myself, piecing together a bunch of different tidbits from random sources, only for TH-cam to recommend your video *after* I finally got setup! Your video is great - complete and concise.
Bummer you found it late!
Awsome job Mate... after watching heaps of useless and incomplete videos, your video tutorial helped me a lot. Finally, I could run the MS SQL Server on my Mac.
That's great to hear! Glad I could help, thanks for watching.
Thank you! I struggled for a few hours, and you made it clear in a matter of minutes! Thanks again :)
Glad it helped!
Thank you very much. This is the most simple, easy and clear tutorial video. I had a problem when create a connection to Azure SQL Edge. Have followed many videos to solve it but it's not resolved, and your video tutorial really helped me to overcome these problems, even the way you explain is simpler, easier and very clear!
I appreciate that and I’m glad it helped!
Finally a video that help me to setup SQLServer on my Mac!! Thank you!! 👍 Keep the good work!!
Glad it helped, thank you!
Thank you very much, you can't imagine how helpful this video was for me
You’re welcome. I’m glad it was helpful!
I watched 3 other videos and they didn't work for me. THIS WORKED! Thanks so much!
You're welcome, thanks for watching!
Thanks for making this video. It really helped me to run SQL Server on my Mac M1 Air.
I’m glad it helped!
Thanks man, I have been struggling with this but this video saved me.
You're very welcome, I'm glad it helped. Thanks for watching!
thank you so much man!! for the video finally something simple and direct
You’re welcome.
this is so awesome thank you! i was looking for exactly this when i tried to install ms-sql server on my m2 air with parallels/windows 11
You’re welcome, I’m glad it helped.
Thank youuuu 😅so so relieved it’s running finally for my Mac M1!
You're welcome, I'm glad it helped!
very nice tutorial! clear and simple! really helped me a lot.
Glad it helped!
You are a lifesaver! Was able to run SQL now. :))
I’m glad it got you up and running!
Nicely done!
Thanks! Really appreciate you checking out!
Great, easy to understand video. Thank you so much!
Glad you enjoyed it!
Thank you so much, pretty straight forward and worked right from the 1st try!
Great to hear! Thanks for watching.
I was creating video explaining Authentication and Authorisation in Blazor, and goddamn I went through so much hustle to connect to DB until this video, thanks a lot man.
No problem, I'm glad it helped!
Sound great to me. Very helpful too ❤
Literally a saviour!
Thank you! Finally, it worked!
Glad it helped!
Thank You! That was helpful!
Working great, thank you!
Thanks a lot. Save me a day!
This is so awesome. Thank you!
You’re welcome!
Great expaination.
I was struggling to connect for a week now until I found your video. Thanks for explaining it sooo nicely!
No problem, I'm glad it helped!
Great video. Thanks
Thanks for watching!
Fantastic!
Thank you, SB!
You’re welcome.
Thank you for this.
You're welcome!
Thank you so much!
thanks it helped
Thanks for your video. it's a great help. Still have a problem, when I'm starting the container it's exiting right away with an error: Drop permitted effective capabilities. Can't find a solution. Could you help please?
Hero!
Thank you very much
You’re welcome! Thanks for watching.
I love you broo ....
Thanks
just found ur channel, awesome info, could u do a vid w/ compose? it's much easier to do docker compose up than the command line
Great suggestion! I'll put it on my list. Thanks for watching!
Just wonder,if want to connect the db in docker(when followed all procedure mentioned), the database server name should be "localhost" Right? Just want to connect it using Visual Studio and name info is needed.
Correct, it should be localhost
Thank you so much! I have additional questions, could you help me please? Can I run Visual Studio via Docker on M2? Can I run SSMS also via Docker?
Thanks!
I don’t think so. You need to run a full windows VM for that. Look at VMWare or Parallels
would you be able to do a run through of actually using azure data studio tutorial, with database creation and tables and queries i'm a bit lost thanks!
I could but it would be a bit before I got to it.
Data studio is lightweight and doesn’t have the same features as a tool like sql server management studio. So you have to use t-sql commands to do things like creating databases and tables.
Here is a reference from Microsoft about creating a database:
learn.microsoft.com/en-us/sql/t-sql/statements/create-database-transact-sql?view=azuresqldb-current&preserve-view=true&tabs=sqlpool#examples-1
@@scriptbytes thank you so much!!
I get "A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)". My container is running fine. I have stucked here for hours. Please let me.
Hi! Thank you for making this video! Would this work with Ventura as well? I read somewhere that ventura needs "rosetta" but I have no idea what it is and how to install it. I am scared to install it wrong, I have no way of fixing it. Do I need Rosetta for Ventura? Thank you!
You do not need Rosetta to run Azure SQL Edge in Docker.
Rosetta is a translation layer that allows you to run apps that were made for Intel chips on an Apple Silicon laptop (the M1/M2 models).
IF it were needed, I think MacOS will prompt you automatically and ask to install it. So it's pretty much impossible to screw up the install.
@@scriptbytes thank you so much for the quick reply. My mac has a M1 chip and I really don't know how it will affect the installation. I feel much more assured after your reply. Thank you for helping us all!
I have some .mdf provided by the client, how it can be "attached" under this scenario?
I'm not very familiar with those files, but a quick google search makes it look like it's possible?
learn.microsoft.com/en-us/azure/azure-sql-edge/backup-restore
Hi friends, I encountered a dquote on the terminal when connecting docker with azure, tried to close it with " but code don't seem to run. Can anyone help please?
Do you have special characters in your password? If so try removing or changing them and try again
well, I had to re-create the container, however now My mac doesn't want to trust the server cert. so how do I get it to trust the cert? When I tell it to trust it, it fails to log on.
It should just ask to trust the cert once.
As for why it's not logging in, it's hard to tell. Are there any messages in the docker logs?
Hello Sir- Can you please show how to import flat files, excel and other formats as well. I tried doing it but i wasn't able to do it. It shows file imported but doesn't show up in any table.
I may be able to do that.
At first when I installed all apps and gave a correct pass in the terminal then I tried to have a new connection but it showed me that error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server: Could not open a connection to SQL Server)....
..
what should I do to solve the issue???
All my work is good and there is no chance of wrong!
I'm not sure, but I would check that the container is still up and running, and also check the logs like I show around the 6:20 mark to see if there is any more information in there that might help out.
any command in terminal it gave me an error that it can not be found any idea?
If the error is ‘docker cannot be found’ then you need to make sure you install docker desktop so you have the docker engine.
Hey I keep getting error:35 trying to create connection
The last step of joining docker to azure brought up an error of a username. I did not change the username I copied so I’m stumped in what I did wrong
What was the error?
I am having problem connecting the sever it says Login failed for user 'sa '. in Azure sql edge
I’m not positive, but it might be a wrong password. If by chance you have any special characters in your password, try recreating the container with an alphanumeric password and see if that works.
following step by step but did you skip the download for azure data studio? :(
Ya I didn’t show the download of that.
Mines not connecting, one question where did you get the Username "sa" from ?
sa is the default username. It is mentioned in the docker hub page link in the description.
Hi, thanks a lot for this great tutorial! I am such a beginner so I got to ask you a stupid question. I am inside the Azure Data Studio and I am struggling with connection. What user name and password should I use? My credentials for Docker Desktop, or Microsoft?
Not a problem!
The username by default will be 'sa'.
The password is the one you provided in the docker run command with the MSSQL_SA_PASSWORD variable.
Yes, it works! Now I made a connection so I will continue watching the rest of this tutorial 😊@@scriptbytes
hi how can i fix this i cannot create the new connection, the error is: A network-related or instance-specific error occurred while establishing a connection to SQL Server. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. Thank you
That's kind of the generic error it gives when there's a connection issue. There may be more info in the logs of the docker container. Sorry it's tough to help with that issue, I hope you got it working!
hello! do you know why this message is appearing to me? "A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)" I can't run the sql
I think I've seen that before for a few different reasons. Is there anything in the docker logs of the container with more info?
I vaguely recall one reason being you had to set this in the connection string: TrustServerCertificate=True
Interesting. Would it be possible to connect to a SQL Edge container from within a Win11 VM?
I’m sure it is. I haven’t done it, but as long as the host and vm networks are setup right I don’t see why it wouldn’t work.
@@scriptbytes @ScriptBytes I might try but am afraid I'll run into this bug again, which appeared when I tried connecting VS2022 arm to localdb and SQL Server Express over the network (it was possible to connect with SSMS, but not VS2022 arm).
@@scriptbytes Unable to reply...
🎉
please help i tried to download sql on virtual machine in m1 but it gives me error why?
Not sure, it’s hard to tell without specifics on the error.
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - No such file or directory) i am getting this error
I’m not sure what causes that error.
If you are providing a volume, are all the paths correct? If you give it a local folder in the volume, does that folder exist on your computer?
great video. However on the final step I am getting following error on my mac:
TCP Provider, error 40 - could not open a connection to SQL server: Could not open a connection to SQL Server
Any help will be appreciated.
It could probably be a lot of things. If you run the docker logs command on the container is there any more info?
@@scriptbytes I am also having this issue. My log says this: [launchpadd] WARNING: Failed to connect to SQL because: dial tcp (My IP address is here(no brackets ofc) but not sure if I should share it publicly?):1431: connect: connection refused, will reattempt connection.
can you please tell me why it says command not found when i enter the first command?
If it says cannot find "docker" then my guess is you need to install Docker Desktop. Do a google search for it and follow the instructions.
I have already installed the docker@@scriptbytes
when i get to the point 5:10, and when I deleted the container and tried this my mac keeps saying "zsh: no such file or directory: host". Just a little lost and frustrated. Any input would be reallly helpful. Also subbed to ur channel for this help!
It's hard to tell without seeing the exact command you're running, sorry. Only thing I can think of is to double check there's not a slash in front of the volume name, otherwise it will think that's the folder on your host and not the volume name.
I hope you get it working though!
oh my god, forget it. IT works! thank you so much!
@@scriptbytes
I'm getting a connection error while trying to create a connection @3:32 Please help thank You?
It’s hard to guess. Is there any info in the docker logs?
it says in my terminal that docker isn't a command
help!
My guess is that either docker isn’t installed or it’s not added to your PATH variable.
If docker is installed, a quick google search shows how to check and/or add docker to your PATH
How fast does this method run SQL queries on big data?
I'm not sure honestly, I haven't used this with really large datasets.
It probably mostly depends on your computer and how much of your resources you've configured Docker to use.
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
it's hard to tell from that error. Is there any more info in the logs about what specifically happened after the login?
@@scriptbytes Thank you so much for your video. Unfortunately I am getting the exact same error and then when I "Enable Trust server certificate" it then says: login failed for user 'SA'. Does this provide any more clarity to the issue?
I was looking for a way to run sql server. Nothing beter on the net!
Wow I really appreciate that, thanks!
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error:40 - Could not open a connection to SQL Server: Could not open a connection to SQL Server)
I've seen that if the container doesn't start correctly and immediately shuts down. Might be some more info in the Docker logs.
TCP Provider, error: 35 - An internal exception was caught ????
can anyone help me?
I got the same error. Did you sort it out?
It's hard to guess what that could be. Was there any more info in the logs like I show around the 6:20 mark?
Can we connect to SQL Server in Azure using C#?
I haven't tried it, but I don't see why you couldn't as long as you have the correct connection information.
Actually, I don't know if I have the right information. I found very little information about it. If you know a video that I will see useful, can you tell me?
Each time I click to the Azure SQL edge page I get a 404 Page not found message. Anyone else get this?
I just went to the page and got a 404 too. Really weird. Hopefully just a small hiccup. I’ll try again tomorrow.
How can I run more than 1 database
In your docker run command, give it a different Host port.
Any unused port is ok to use on the host side:
For example -p 5431:5432
Or -p 5000:5432
Then when you connect, use that host port in your connection.
What and how do i get to terminal 😭
Cmd+space will bring up spotlight, then type ‘terminal’ and select it to open it.
@@scriptbytes thank you it worked
when ever i run the command with the password it says quote>
I vaguely recall seeing that output when there is an extra quote somewhere in the command, or a special character the terminal is interpreting wrong. Might check the password doesn't have any weird characters (", etc)
I got these message ------------> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server: Could not open a connection to SQL Server)
Not sure why, was there any more info in the docker logs?
got the same error, did you find any way to fix it?
"2023-04-27 11:49:14.74 spid25s ERROR: Unable to set system administrator password: Password validation failed. The password does not meet SQL Server password policy requirements because it is not complex enough. The password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols..
2023-04-27 11:49:14.76 spid25s An error occurred during server setup. See previous errors for more information.
2023-04-27 11:49:14.76 spid25s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.
2023-04-27 17:19:14 2023/04/27 11:49:14 [launchpad] [06333ae9] [0b69cc1c] ERROR: Error reading: EOF"
These are the logs. ig the password needs to be complex and should adhere to the requirements then it should work.
@@MrXsagat got the same error , have u fixed it ?
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server: Could not open a connection to SQL Server) you can support me to fix error
It's tough to tell for sure what might cause that. It could be a lot of things, like a bad connection string, or the database didn't start up correctly, etc.
Checking the docker logs for the container may have some more info as well.