This is a development edition. Upgraded MySql and also using native TLS. A TLSCLient without openssl. All native crystal. Far from production.
The content here is as follows
(tree -L 2)
── APPLICS
│ ├── MYSQL
│ ├── web1
│ ├── web2
│ └── web3
├── LIBS
│ ├── librfc8439
│ ├── mysql
│ ├── shared
│ └── tlsclient
└── README.md
- mixed (local and remote)
- localonly (local only. to tryout)
- remoteomly (remote ony. to tryout)
- librfc8439 (source git but with extensions)
- mysql
- shared
- tlsclient
Before you can start building you must look into all shard.yml because there are dependencies using path like:
(one for each APPL/* and one for each LIBS/*)
dependencies:
tlsclient:
path: <your path to this folder>/LIBS/tlsclientfor each LIBS
shards update
crystal docs
for each APPLIC
shards update
shards build
Then just try build one, with or without debug options, for mysql (application 'mixed' )
You can include debug trace for each library if you compile with -Dtrctls -Dtrcsql -Dtrcshared
<>APPLICS/MYSQL/mixed> shards update
<>APPLICS/MYSQL/mixed> shards build
<>APPLICS/MYSQL/mixed> shards build --debug
<>APPLICS/MYSQL/mixed> shards build --debug -Dtrcsql -Dtrcshared
Edit /opt/homebrew/etc/my.cnf to hold
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
# bind-address = 0.0.0.0 -->
# mysqlx-bind-address = 127.0.0.1
# Allow tls connection
ssl_ca=ca.pem
ssl_cert=server-cert.pem
ssl_key=server-key.pem
tls_version=TLSv1.2,TLSv1.3
require_secure_transport=ON
and run it with proper parameters
<>APPLICS/MYSQL/mixed> ./bin/mixed "url to database" "sql statement"
<>APPLICS/MYSQL/mixed> ./bin/mixed 7 # precompiled test number 7
Example
<>APPLICS/MYSQL/mixed> ./bin/mixed "mysql://root:___@localhost/information_schema" "SELECT table_name FROM columns"
There are some unresolved issues
- APPLIC/web1: several web sites are hard to set up to a proper connection. This application 'APPLIC/web1' and the next 'APPLIC/MYSQL/mixed' use the same LIBS/tlsclient. 'APPLIC/MYSQL/mixed' works fine using tls but 'APPLIC/web1' struggles
- APPLIC/MYSQL/mixed: two use case are not verified
- Running mysql through firewall/proxy and tls is not tested.
Besides that there sevaral points to work on
- Comments in general
- Optimize LIBS/shared/*.cr to utilize hardware around crypto functions
- This edition is build on MacOs Sequoia 15.3.2 (24D81) and Crystal 1.14.0 (2024-10-09)
- No windows or bigendian is verified
- Raise is not clever used at the moment
- Extend the
specfolder
crystal tool unreachable src/mysql.cr
crystal tool hierarchy src/web1.cr -e TLSClient
crystal tool dependencies src/mysql.cr
https://tableconvert.com/csv-to-html
https://sandbox.swedenconnect.se/cap/asn1
Rename a file in git
git mv LIBS/mysql/src/mysql/connectionnyare.cr LIBS/mysql/src/mysql/connection.cr