Remote connection to MySQL

Few months ago I’ve tested connection between Excel and MySQL database on local computer. Test hasn’t been performed with database located on external server – I think it should works too.

Supposed, there is need to write application where is main user (with price update) and external entities that will work with app. Let’s imagine you are selling your stuff in retail by contracted local shops. You might write Excel application to finalize order. What is important, dealing price update only main user will change it database. Additionally most of users have already installed Excel, there is no need to install additional software.

To allowed remote connection to MySQL database located on external server new user has to be added with extended privileges . This is a situation when Excel is on personal computer, and MySQL is located on external device.

Be careful when you provide Excel app to external entities. Protect your code/project. Set up strong password, because connectionstring is unencrypted in VBA console.

Settings in MySQL have to be change in order to connect Excel with external database/table. External means some hosting. The best way is to create new user with needed privileges.

I’ve tested it long time ago – don’t know if still working.

Source: http://stackoverflow.com/questions/10236000/allow-all-remote-connections-mysql

For test connection following action is needed:

  1.  New database has to be created in MySQL
  2. Add new table to db e.g. “UsersName” with filed “ID, Name, Age”
  3. Add new user in MySQL:
Create USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
Create USER 'username'@'%' IDENTIFIED BY 'password'; 
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION; 'FLUSH PRIVILEGES;

User access exclusions:
*.* means all databases and tables
db_name.* means tables in specific database
db_name*tbl_name means specific database and table

Adding following code to VBA modul:

' If following code was useful for you, please consider to click some ad.
' Server and domain maintain will be cheaper ;) Thanks.
' http://exceldb.net/

' Source:
' http://stackoverflow.com/questions/13558921/how-can-vba-connect-to-mysql-database-in-excel#13558978

Private Sub mysqlconnection()
Dim Password As String
Dim SQLStr As String
Dim Server_Name As String
Dim User_ID As String
Dim Database_Name As String

Set rs = CreateObject("ADODB.Recordset") 'EBGen-Daily
Server_Name = "***.***.*.***"
Database_Name = "db_name"
User_ID = "user_name"
Password = "password"

SQLStr = "INSERT INTO user (id,name,age) VALUES (9,'John',45)"

Set Cn = CreateObject("ADODB.Connection") 'NEW STATEMENT
Cn.Open "Driver={MySQL ODBC 5.3 Unicode Driver};Server=" & _
        Server_Name & ";Database=" & Database_Name & _
        ";Uid=" & User_ID & ";Pwd=" & Password & ";"

rs.Open SQLStr, Cn, adOpenStatic

Set rs = Nothing
Cn.Close
Set Cn = Nothing
End Sub

306 thoughts on “Remote connection to MySQL

  1. Pingback: ConnectionString for MySQL w VB.NET | My Excel Database

  2. Pingback: 여우티비

  3. Pingback: http://144.91.94.12/

  4. Pingback: One-North Eden

  5. Pingback: buy/order hydrocodone online pharmacy legally cheap no script for pain, anxiety from USA UK Canada Australia Europe overseas overnight delivery

  6. Pingback: so con heo

  7. Pingback: order generic morphine without prescription online pharmacy cheap

  8. Pingback: keo bing da

  9. Pingback: mơ thấy người chết đánh đề con gì

  10. Pingback: order demerol online in usa canada uk australia without prescription nextday shipping

  11. Pingback: purchase adipex-p online for sale near me no prescription overnight delivery cheap

  12. Pingback: bitcoin era reviews 2020

  13. Pingback: trang web đánh lô đề uy tín

  14. Pingback: so de con cho

  15. Pingback: check my reference

  16. Pingback: de kep

  17. Pingback: french bulldog puppies for sale near me in CA ON MA CO OH PA SC MS TN FL UT NH VA AL TX

  18. Pingback: UNICCSHOP

  19. Pingback: diamond art kits

  20. Pingback: bitcoin evolution review

  21. Pingback: fake gucci watch

  22. Pingback: Buy strawberry cough strain/seeds use for pain, anxiety, sleep for sale near me in bulk in USA UK NZ Canada Australia from a legit online dispensary with free overnight delivery

  23. Pingback: Bitcoin Evolution Review

  24. Pingback: pinewswire

  25. Pingback: 마루마루

  26. Pingback: buy sildenafil citrate generic pills 25mg 50mg 100mg for sale online overnight cheap

  27. Pingback: soma for sale overnight

  28. Pingback: where to buy oxycontin in usa

  29. Pingback: bitcoin loophole reviews

  30. Pingback: immediate edge bitcoin

  31. Pingback: nằm mơ thấy con rết là điềm gì

  32. Pingback: mơ thấy anh em gặp nhau

  33. Pingback: beagle puppies for sale

  34. Pingback: 메이저사이트

  35. Pingback: easy1up

  36. Pingback: nam mo thay ran danh con gi

  37. Pingback: เงินด่วน 30 นาที

  38. Pingback: Rock Island Armory VR80 12ga Shotgun

  39. Pingback: eliquids

  40. Pingback: Panzer Arms BP-12

  41. Pingback: mơ thấy bắn nhau

  42. Pingback: nằm mơ thấy mẹ bị bệnh nặng

  43. Pingback: chiem bao thay lua

  44. Pingback: nằm mơ thấy nhà mới

  45. Pingback: mơ thấy bắp ngô

  46. Pingback: chó bị chết là điềm gì

  47. Pingback: mơ thấy vợ đánh con gì

  48. Pingback: nằm mơ bị rụng răng

  49. Pingback: Stiiizy pods

  50. Pingback: safe to buy levitra online

  51. Pingback: cialis frequency of use

  52. Pingback: buy viagra mastercard

  53. Pingback: college essay writer

  54. Pingback: order cheap cialis online

  55. Pingback: cialis buy

  56. Pingback: tadalafil

  57. Pingback: generic cialis cost

  58. Pingback: womens viagra

  59. Pingback: roman viagra

  60. Pingback: do you need a prescription for viagra

  61. Pingback: viagra dosage

  62. Pingback: discount pharmacy card

  63. Pingback: canadian drugstore online

  64. Pingback: Viagra Soft Flavored

  65. Pingback: no prescription online pharmacy

  66. Pingback: viagra

  67. Pingback: viagra

  68. Pingback: how to cut cialis

  69. Pingback: viagra discount coupons

  70. Pingback: viagra 100mg pills for men

  71. Pingback: free cialis trail

  72. Pingback: tax dollars viagra

  73. Pingback: generic cialis no prescription

  74. Pingback: viagra gay bottom

  75. Pingback: cialis on the web

  76. Pingback: buy cialis philippines

  77. Pingback: viagra sale canada

  78. Pingback: what does amoxicillin do

  79. Pingback: aquatic azithromycin

  80. Pingback: generic name for celebrex

  81. Pingback: cephalexin cost without insurance

  82. Pingback: generic cialis daily pricing

  83. Pingback: cymbalta morning or night

  84. Pingback: amoxicillin for bladder infections

  85. Pingback: cost of tadalafil without insurance

  86. Pingback: azithromycin without prescription

  87. Pingback: buy cialis cheap canada

  88. Pingback: celebrex blurry vision

  89. Pingback: how harmful is cephalexin

  90. Pingback: cymbalta drug name

  91. Pingback: buy cialis insurance

  92. Pingback: sildenafil cvs

  93. Pingback: cialis patent information

  94. Pingback: buy cialis philippines

  95. Pingback: buy cialis canadian

  96. Pingback: medication other than viagra

  97. Pingback: cialis 20 mg cost

  98. Pingback: viagra naturale

  99. Pingback: cialis wikipedia

  100. Pingback: viagra sex

  101. Pingback: how to take cialis

  102. Pingback: cialis or viagra

  103. Pingback: i took viagra mom

  104. Pingback: cialis generic name

  105. Pingback: generic cialis cheap

  106. Pingback: cialis tadalafil

  107. Pingback: viagra reviews

  108. Pingback: viagra side effects

  109. Pingback: accidental viagra

  110. Pingback: sildenafil 100mg price

  111. Pingback: cialis vs levitra

  112. Pingback: effects of viagra

  113. Pingback: 100 mg viagra

  114. Pingback: viagra pills for sale

  115. Pingback: side effects of viagra

  116. Pingback: phd thesis search

  117. Pingback: natural viagra on you tube

  118. Pingback: sildenafil how to use

  119. Pingback: generic cialis mexico

  120. Pingback: viagra coupons 2018

  121. Pingback: viagra greneric name

  122. Pingback: viagra cialis over counter

  123. Pingback: viagra versus cialis

  124. Pingback: nitrous is viagra

  125. Pingback: viagra for sale rockford il

  126. Pingback: men having sex using viagra

  127. Pingback: cheap sildenafil 50mg

  128. Pingback: generic viagra india australia

  129. Pingback: online sildenafil usa

  130. You’ve made some good points there. I looked on the internet for
    more information about the issue and found most people will go along with your views on this website.

  131. Pingback: metformin online india

  132. Hello, i feel that i saw you visited my web site so i got here to
    return the desire?.I am attempting to in finding things to improve my web site!I suppose its
    good enough to use a few of your concepts!!

  133. Pingback: finasteride medication

  134. Pingback: propecia finasteride

  135. Pingback: generic ed drugs

  136. Pingback: top erection pills

  137. Pingback: northern pharmacy

  138. Pingback: www pharmacyonline

  139. Pingback: buy cialis philippines

  140. Pingback: buy cialis in miami

  141. Pingback: chewable viagra

  142. Oh my goodness! a huge article dude. Thanks However I am experiencing situation with ur rss . Don’t know why Not able to sign up to it. Can there be anyone getting similar rss problem? Anybody who is conscious of kindly respond. 토토사이트

  143. Pingback: lisinopril 40

  144. Pingback: price of lisinopril in india

  145. Pingback: where to buy cialis online for cheap

  146. Pingback: cialis profesional vs. super active vs. cialis

  147. Pingback: generic version of cialis

  148. Pingback: cholesterol

  149. Pingback: i want to buy cialis in australia

  150. You have performed a great job on this article.It’s very precise and highly qualitative. You have even managed to make it readable and easy to read. You have some real writing talent. Thank you so much. 먹튀검증

  151. Pingback: buy cialis rush

  152. Hello! I was checking out your blog for the first time this morning and wanted to drop a note that it was very cool. I wanted to share my site too. You can learn about past lives there. Check it out if you’re interested. Thanks!! 승부벳

  153. Pingback: reliable online pharmacy

  154. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful. 먹튀검증

  155. Pingback: cialis without presciption in usa

  156. I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he ejoyed it as well! 토토사이트

  157. Pingback: where to buy cialis with paypal

  158. Pingback: safe canadian pharmacies to order from

  159. I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article. 먹튀폴리스

  160. Pingback: much does cialis cost without insurance

  161. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. 토토나라

  162. “Greetings! Very helpful advice in this particular post! It is
    the little changes that produce the most significant changes.
    Thanks for sharing!” 먹튀

  163. Nice to be visiting your blog again, it has been months for me. Well this article that i’ve been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, grea 먹튀검증

  164. Pingback: can i buy cialis in uk

  165. You have done a great job on this article. It’s very readable and highly intelligent. You have even managed to make it understandable and easy to read. You have some real writing talent. Thank you. 먹튀검증

  166. Pingback: generic cialis 20 mg tadalafil

  167. Pingback: can i buy cialis online

  168.  I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more. 토토

  169. All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks 승부벳

  170. Pingback: natural cures for ed

  171. Pingback: buy valtrex

  172. What an incredibly beautiful story, despite the fact that it is rugged but the result turned out to be kind and good and now it has become a tradition that is passed on in every generation. atv dealer

  173. Pingback: best ed pill

  174. You…are…my…hero!!! I cant believe something like this exists on the internet! Its so true, so honest, and more than that you dont sound like an idiot! Finally, someone who knows how to talk about a subject without sounding like a kid who didnt get that bike he wanted for Christmas. 슈어맨주소

  175. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates. 토토

  176. I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more. 토토사이트

  177. It is a completely interesting blog publish.I often visit your posts for my project’s help about Diwali Bumper Lottery and your super writing capabilities genuinely go away me taken aback.Thank you a lot for this publish.

  178. It’s astoundingly valuable and you are plainly to a great degree capable around there. You have opened my eyes to moving viewpoints on this point with charming and solid substance.

  179. Pingback: injections for ed

  180. Pingback: buying viagra online

  181. Pingback: comparison of ed drugs

  182. Pingback: drug prices comparison

  183. Pingback: stromectol tablets for humans

  184. Pingback: american dating free online usa

  185. Pingback: plaquenil online mexico

  186. Pingback: plaquenil 100 mg

  187. Pingback: ivermectin usa price

  188. Pingback: where to buy stromectol

  189. Pingback: Google

  190. Pingback: sildenafil without a doctor's prescription

  191. Pingback: escort bayan

  192. Pingback: Parksville Roofers

  193. Pingback: captain beds near me

  194. Pingback: Rainbow Boa

  195. Pingback: 450 bushmaster ammo

  196. Pingback: order viagra online

  197. Pingback: canadian hydroxychloroquine

  198. Pingback: how to lose lower belly fat

  199. Pingback: generic cialis 20 mg tadalafil

  200. Pingback: ordering cialis online australia

  201. Pingback: hydroxychloroquine dosage for malarial

  202. Pingback: hydroxychloroquine 200mg prices

  203. this was a actually nice post. In concept I wish to put in writing like this furthermore – taking time and actual effort to make an outstanding article
    however what can I say I procrastinate alot and not at all appear to get something done.

Leave a Reply

Your email address will not be published. Required fields are marked *