digitalmars.D.learn - How to interface with MySql 9.6?
- realhet (14/14) Feb 19 Hi,
- Serg Gini (3/5) Feb 19 idk but you can try also Adam's library:
- realhet (5/10) Feb 19 Thank you, I will do that now.
- realhet (16/22) Feb 19 I've tried arsd.mysql too:
- Adam D. Ruppe (4/6) Feb 19 No it doesn't. Did you actually try to use it? What's your test
- realhet (17/23) Feb 20 It was my fault, finally made it running:
- Adam D. Ruppe (4/8) Feb 20 Do `dmd -i mysql.d` and let the compiler find the dependencies.
- realhet (46/55) Feb 20 Can't use -i for the heavy lifting.
- Adam D. Ruppe (12/17) Feb 20 I do it for everything. It works well, you just have a lot of
- realhet (6/13) Feb 20 I just commented out the import dom and import cgi statements and
- realhet (26/35) Feb 20 Please help me with this linker issue:
- realhet (22/30) Feb 20 Never mind this!
- Adam D. Ruppe (11/19) Feb 20 mssql uses ODBC which is a system lib and it might be linked
- realhet (8/13) Feb 20 Yeah, the new internal LDC linker is good.
- apz28 (6/14) Feb 19 You can try my packages - if bug found, please create one
- realhet (12/19) Feb 19 Thanks!
- Steven Schveighoffer (11/21) Feb 20 This was a known issue with 8, I have punted on it for a long
- Serg Gini (3/4) Feb 20 https://code.dlang.org/packages/sha3-d ?
Hi, I tried to get help form AI but it's fooling me relentlessly ;) I've tried mysql-d/mysql-native. It says can't connect because the authentication method not supported. MySql 9.6 supports only these: sha256_password, caching_sha2_password I can't select the old plugin called: mysql_native_password The other library I tried was: github.com/pszturmaj/ddb But I only see postgres.d module there. AI just hallucinated mysql.d there for me to please me. Now I'm, gonna try mysql-d/mysql-native with an old MySql4 server. If anyone knows, how can I use a lightweight sql server on my own machine from DLang in 2026, please tell me.
Feb 19
On Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:If anyone knows, how can I use a lightweight sql server on my own machine from DLang in 2026, please tell me.idk but you can try also Adam's library: http://arsd-official.dpldocs.info/arsd.mysql.MySql.html
Feb 19
On Thursday, 19 February 2026 at 23:02:37 UTC, Serg Gini wrote:On Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:Thank you, I will do that now. In the meantime I had success with: * mysql-d/mysql-native * MySql 5.7 (Win 64bit)If anyone knows, how can I use a lightweight sql server on my own machine from DLang in 2026, please tell me.idk but you can try also Adam's library: http://arsd-official.dpldocs.info/arsd.mysql.MySql.html
Feb 19
On Thursday, 19 February 2026 at 23:24:53 UTC, realhet wrote:On Thursday, 19 February 2026 at 23:02:37 UTC, Serg Gini wrote:I've tried arsd.mysql too: It seems larger, it pulls 31 modules from the mysql module. I stuck because it requires the Postgres library too. I commented out 2 lines from arsd.database.d: ```d import arsd.postgres; // FIXME is this really postgres only? looks like sqlite has no similar function... maybe make a view then sqlite3_table_column_metadata ? static assert(is(DriverType == PostgreSql), "Only implemented for postgres right now"); ``` Now it doesn't need needs pq.lib, but now the exe immediatelly exits with no errors at start. So I don't force it more. I will come back to it when I will need MSSQL access in the future.On Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:In the meantime I had success with: * mysql-d/mysql-native * MySql 5.7 (Win 64bit)If anyone knows, how can I use a lightweight sql server on my
Feb 19
On Thursday, 19 February 2026 at 23:51:13 UTC, realhet wrote:It seems larger, it pulls 31 modules from the mysql module.What does this even mean?I stuck because it requires the Postgres library too.No it doesn't. Did you actually try to use it? What's your test code?
Feb 19
On Friday, 20 February 2026 at 00:31:19 UTC, Adam D. Ruppe wrote:On Thursday, 19 February 2026 at 23:51:13 UTC, realhet wrote:It was my fault, finally made it running: * Something's wrong with my IDE, when it launches a console exe, somehow it closes immediately when a windows error happens. If I run it from commandline, then the windows popup error window becomes visible: "Error can't find xy.dll" So I was provide required dll-s. 31 modules -> What does this even mean? * My parallel BuildSystem is dumb: It tries to compile ALL imports, even the ones that has false conditions (version(), debug() static if()). And arsd has a ton of conditional imports. But I can't avoid that buildsys it because it is fast. ;) Now I'm compiling only these arsd modules: mysql, jsvar, script, http2, uri, characterencodings, string, conv, database, dom, core, cgi I believe this is the smallest set required for MySql. And it connected successfully to the MySql 9.6 server, Thank You!It seems larger, it pulls 31 modules from the mysql module.What does this even mean?I stuck because it requires the Postgres library too.No it doesn't. Did you actually try to use it? What's your test code?
Feb 20
On Friday, 20 February 2026 at 16:21:58 UTC, realhet wrote:Now I'm compiling only these arsd modules: mysql, jsvar, script, http2, uri, characterencodings, string, conv, database, dom, core, cgi I believe this is the smallest set required for MySql.Do `dmd -i mysql.d` and let the compiler find the dependencies. But it requires only three: mysql.d, database.d, and core.d. It compiles in under a second from scratch.
Feb 20
On Friday, 20 February 2026 at 16:45:35 UTC, Adam D. Ruppe wrote:On Friday, 20 February 2026 at 16:21:58 UTC, realhet wrote:Can't use -i for the heavy lifting. My buildsys has another addicting feature: It caches the object files for the unchanged modules. So my workflow is something like this: On the start of a day I open a project with 100KLOC and 30 modules, on the first build it takes some time on my old AMD FX8350 8 core cpu, around 2-3 minutes. But after I have a budget: If I only modify less than 8 modules (recursively), then it is posibble to launch a separate LDC2 compiler for each module, so normally I can see what I did in 20-30 seconds (and that's release mode). And I have the opportunity to modify my framework too, not just project code. Only when I modify my `core` module, that takes long but normally I can have acceptable build times. Another bonus is that I immediatelly see the errors, so I can break all the build process any time, modify, then try again. What would help this is would be that "import discovery feature" of the compiler: I could call it for each modules recursively. But I've checked that years ago and it seemed not too fast. And I just love compile time code generation. So this import detection feature would take a while. This dumb discovery feature of my buildsys takes only below milliseconds, because the code is already in reach, cached, preprocessed. But I have to make it more clever. Another cool feature would be a build overwatch thing: An automata that can act in every frame (at 60FPS): It can always check the current build requirements and solve it. No strict start-end build process, just a service that caches and compiles the modules and when all is ready, it finally calls the linker and launches the exe and goes to sleep for a while. With this, I could let myself edit and save files while a build is already in progress. Now I need to abort it first, that unfortunatelly includes the unchanged modules as well. Just a rough example: All that 13 modules take 6.5seconds. Then I only put a space in the mysql module it becomes 2 seconds.Now I'm compiling only these arsd modules: mysql, jsvar, script, http2, uri, characterencodings, string, conv, database, dom, core, cgi I believe this is the smallest set required for MySql.Do `dmd -i mysql.d` and let the compiler find the dependencies. But it requires only three: mysql.d, database.d, and core.d. It compiles in under a second from scratch.But it requires only three: mysql.d, database.d, and core.dI will try to restrict to these, but I think there are more needed: For example cgi module is used in that RowOperations template: fromRow, toRow, I think that's important, but will see. ``` ldc2 test_MySql_arsd.d -o- --deps=deps.txt -I c:\D\libs ``` That's 4 seconds here. And only after this I can launch the 8 LDC2 instances... Way too much. But I should make use of this on a separate thread in the background. Anyways I gotta solve this, but not now. :D
Feb 20
On Friday, 20 February 2026 at 18:27:42 UTC, realhet wrote:Can't use -i for the heavy lifting.I do it for everything. It works well, you just have a lot of bloat attached.first build it takes some time on my old AMD FX8350 8 core cpu around 2-3 minutes.Meanwhile, I have an older 4 core cpu, I build the entire project from scratch, and I'm done in under 2 seconds. If you use -i, it doesn't pull stuff it doesn't actually need. Like you saidI just commented out the import dom and import cgi statements and it was still able to SELECT some rows from a table.Why did you import them in the first place? Only import the things you actually use! The arsd library is over a quarter million lines of code, and you probably only need like 2,000 of them. So import the one or two modules you actually use and find joy.
Feb 20
On Friday, 20 February 2026 at 16:45:35 UTC, Adam D. Ruppe wrote:On Friday, 20 February 2026 at 16:21:58 UTC, realhet wrote:I just commented out the import dom and import cgi statements and it was still able to SELECT some rows from a table. Now this is lightweight, Thanks! BuildStats: 2.167 seconds, 4 modules, 17174 source lines, 468806 source bytesNow I'm compiling only these arsd modules: mysql, jsvar, script, http2, uri, characterencodings, string, conv, database, dom, core, cgi I believe this is the smallest set required for MySql.But it requires only three: mysql.d, database.d, and core.d. It compiles in under a second from scratch.
Feb 20
On Friday, 20 February 2026 at 16:45:35 UTC, Adam D. Ruppe wrote:On Friday, 20 February 2026 at 16:21:58 UTC, realhet wrote:Please help me with this linker issue: I'm now trying to use arsd.mssql. And the linker requires the following libs: libcmt.lib libvcruntime.lib libucrt.lib When I copy those files (I know it's bad.) It gives the error: BuildSys: Link Error: 1 lld-link: error: undefined symbol: filenoNow I'm compiling only these arsd modules: mysql, jsvar,This is something triggered by a bad odbc32.lib or what? I've found libcmt.lib in a VS2022 folder that SQL Management Studio installed for itself just today. I also have 2 Deprecation messages: Deprecation: module `etc.c.odbc.sql` is deprecated - The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package. Deprecation: module `etc.c.odbc.sqlext` is deprecated - The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package. I tried to use etc.c.odbc.odbc64 then. It had some parameter type mismatches: cast(short) from int. And then I got the same frustrating libcmt.lib linker error. o.O LDC - the LLVM D compiler (1.41.0): based on DMD v2.111.0 and LLVM 20.1.5 built with LDC - the LLVM D compiler (1.41.0) Default target: x86_64-pc-windows-msvcreferenced by phobos2-ldc.lib(stdio.obj):(_D3std5stdio4File4syncMFNeZv) referenced by phobos2-ldc.lib(stdio.obj):(_D3std5stdio4File13windowsHandleMFNdZPv) referenced by phobos2-ldc.lib(stdio.obj):(_D3std5stdio4File4lockMFEQxQv8LockTypemmZv) referenced 18 more times
Feb 20
On Friday, 20 February 2026 at 21:31:09 UTC, realhet wrote:On Friday, 20 February 2026 at 16:45:35 UTC, Adam D. Ruppe wrote:Never mind this! By installing MS SQL Server Management Studio 2022, I successfully destroyed my working DLang environment. Now every project I try to compile fails. I'm crying out loud now XD ---------------------------------------------------------------------------On Friday, 20 February 2026 at 16:21:58 UTC, realhet wrote:Please help me with this linker issue: libcmt.libNow I'm compiling only these arsd modules: mysql, jsvar,Why did you import them in the first place? Only import the things you actually use!My build system is not too clever, it works like this: ```d module arsd.database; ... void fun() //a function that I'm not using { import arsd.dom, arsd.cgi; //<- my custom buildsystem sees this, and it automatically compiles. ... } ... ``` And WHY I use a custom build system? -> Because I need it for my custom IDE -> youtube.com/ realhet/videos It's a bit of a problem that with Adam's library it goes nuts, but I'm working on it. :D
Feb 20
On Friday, 20 February 2026 at 21:31:09 UTC, realhet wrote:I'm now trying to use arsd.mssql. And the linker requires the following libs:mssql uses ODBC which is a system lib and it might be linked against a different C runtime than Phobos. OpenD tried to fix this buy consistently using the ucrt but upstream.... well, ldc usually does the right thing, it is more dmd opend had to fix. And I see you're using ldc so idk, but the only lib you should be specifying is odbc32 (which my module will do with pragma(lib)), do not specify the other urct, etc ones, leave that to the system, and MAYBE it'll help, idk though.Deprecation: module `etc.c.odbc.sql` is deprecated - The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package. Deprecation: module `etc.c.odbc.sqlext` is deprecated - The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package.well this is upstream doing upstream things i guess, they love breaking perfectly working code every other release.
Feb 20
On Friday, 20 February 2026 at 22:18:32 UTC, Adam D. Ruppe wrote:On Friday, 20 February 2026 at 21:31:09 UTC, realhet wrote:Yeah, the new internal LDC linker is good. This time I somehow ruined the MS Build Tools / Windows SDK by installing MS SQL Server Management Studio. I uninstalled that and the server, reinstalled build tools and all else except MSSSMS and the libcmt linker error vanished. Now I have 3 ways to connect to MySql and one more way to MSSql, Thank you all for the help!I'm now trying to use arsd.mssql. And the linker requires the following libs:well, ldc usually does the right thing
Feb 20
On Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:Hi, I tried to get help form AI but it's fooling me relentlessly ;) I've tried mysql-d/mysql-native. It says can't connect because the authentication method not supported. MySql 9.6 supports only these: sha256_password, caching_sha2_password I can't select the old plugin called: mysql_native_passwordYou can try my packages - if bug found, please create one Look unittest in module pham.db.db_mydatabase for DbIntegratedSecurityConnection.srp256 https://github.com/apz28/dlang/tree/main/source/pham/db https://code.dlang.org/packages/pham_library
Feb 19
On Thursday, 19 February 2026 at 23:32:05 UTC, apz28 wrote:On Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:Thanks! pham.db.db_myexception.MyException c:\d\libs\pham\db\db_myprotocol.d(912): Unsupported authenticated type: mysql_native_password Now it turned out, that my older MySql version which works with mysql-d/mysql-native is too old for your library. I've made a user with sha authentication, but the default on this MySql version is still `mysql_native_password`, so the pham.db library gives up. Now I will stick to MySql5.7, I'm happy that it finally works. And later if I have to work with a bigger server, I will have some ideas. Thank you All!Hi,You can try my packages - if bug found, please create one Look unittest in module pham.db.db_mydatabase for DbIntegratedSecurityConnection.srp256 https://github.com/apz28/dlang/tree/main/source/pham/db https://code.dlang.org/packages/pham_library
Feb 19
On Friday, 20 February 2026 at 00:22:15 UTC, realhet wrote:On Thursday, 19 February 2026 at 23:32:05 UTC, apz28 wrote:It is a lack of clarification, it supports 4 types mysql_native_password, SCRAM-SHA-1, caching_sha2_password & authentication_windows_client You need to set connection.connectionStringBuilder.integratedSecurity = DbIntegratedSecurityConnection.legacy; // To a one that required by database server DbIntegratedSecurityConnection.legacy = mysql_native_password DbIntegratedSecurityConnection.srp1 = SCRAM-SHA-1 DbIntegratedSecurityConnection.srp256 = caching_sha2_password DbIntegratedSecurityConnection.sspi = authentication_windows_clientOn Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:Thanks! pham.db.db_myexception.MyException c:\d\libs\pham\db\db_myprotocol.d(912): Unsupported authenticated type: mysql_native_password Now it turned out, that my older MySql version which works with mysql-d/mysql-native is too old for your library. I've made a user with sha authentication, but the default on this MySql version is still `mysql_native_password`, so the pham.db library gives up. Now I will stick to MySql5.7, I'm happy that it finally works. And later if I have to work with a bigger server, I will have some ideas. Thank you All!Hi,You can try my packages - if bug found, please create one Look unittest in module pham.db.db_mydatabase for DbIntegratedSecurityConnection.srp256 https://github.com/apz28/dlang/tree/main/source/pham/db https://code.dlang.org/packages/pham_library
Feb 20
On Friday, 20 February 2026 at 12:42:13 UTC, apz28 wrote:On Friday, 20 February 2026 at 00:22:15 UTC, realhet wrote:When make build, you need to include all db_myauth_...d modules/files so that it will register the authentication method. shared static this() nothrow safe { DbAuth.registerAuthMap(DbAuthMap(myAuthNativeName, DbScheme.my, &createAuthNative)); }[...]It is a lack of clarification, it supports 4 types mysql_native_password, SCRAM-SHA-1, caching_sha2_password & authentication_windows_client You need to set connection.connectionStringBuilder.integratedSecurity = DbIntegratedSecurityConnection.legacy; // To a one that required by database server DbIntegratedSecurityConnection.legacy = mysql_native_password DbIntegratedSecurityConnection.srp1 = SCRAM-SHA-1 DbIntegratedSecurityConnection.srp256 = caching_sha2_password DbIntegratedSecurityConnection.sspi = authentication_windows_client
Feb 20
On Friday, 20 February 2026 at 13:05:04 UTC, apz28 wrote:On Friday, 20 February 2026 at 12:42:13 UTC, apz28 wrote:This works too, Thank you! Here I summarize all 3 methods of connecting to a MySql server on Win10 from DLang in 2026: ``` /+ mysql-d/mysql-native 33 modules, 11236 source lines, 331499 source bytes, 1.6MB exe Requires no dlls, no libs. Only works with old MySql 5.6, no SSL +/ /+ arsd.mysql 13 modules, 54330 source lines, 1619412 source bytes, 2.3MB exe Requires: libmysql.lib and .dll, OpenSSL 3 Works with latest MySql 9.6, mandatory secure connection +/ /+ pham.db.db_mydatabase 97 modules, 114309 source lines, 4005137 source bytes, 4.2MB exe Requires: OpenSSL Works with latest MySql 9.6, mandatory secure connection +/ ```On Friday, 20 February 2026 at 00:22:15 UTC, realhet wrote:When make build, you need to include all db_myauth_...d modules/files so that it will register the authentication method.[...]
Feb 20
On Thursday, 19 February 2026 at 22:54:42 UTC, realhet wrote:Hi, I tried to get help form AI but it's fooling me relentlessly ;) I've tried mysql-d/mysql-native. It says can't connect because the authentication method not supported. MySql 9.6 supports only these: sha256_password, caching_sha2_password I can't select the old plugin called: mysql_native_passwordThis was a known issue with 8, I have punted on it for a long time because mysql-native uses a pure D implementation, and I'm not sure what to do for cryptography in this case. Issue is here: https://github.com/mysql-d/mysql-native/issues/189Now I'm, gonna try mysql-d/mysql-native with an old MySql4 server.I've used Mysql 8 with mysql-native for a while. You just have to disable the requirement to use encryption for the password exchange. I have not tried Mysql 9 yet, but it sounds like that option is no longer available. -Steve
Feb 20
On Friday, 20 February 2026 at 14:23:16 UTC, Steven Schveighoffer wrote:not sure what to do for cryptography in this case.https://code.dlang.org/packages/sha3-d ?
Feb 20









Adam D. Ruppe <destructionator gmail.com> 