version 2004
MySQL_Connect (server; database; user; password) Longint
| Parameter | Type | Description | |
| server | String | IP address of MySQL server | |
| database | String | Individual MySQL database to connect to | |
| user | String | User name | |
| password | String | Password | |
| Function result | Longint | Connection ID |
Description
The MySQL_Connect command returns a Longint that can be passed to any MySQLConnect for 4D methods that expect a connection ID. MySQL_Connect returns 0 when the connection could not be established. Use MySQL_LastConnectFailure to get the reason for this failure.
Once you are done with the connection to the MySQL server, you can call MySQL_Close to indicate you are done with the connection.
server is a String that specifies the server to connect to either using a DNS address or the x.x.x.x form.
database is a String containing the name of the database you want to connect to.
user is a String containing the user name.
password is a String containing the password.
Example
connID:=MySQL_Connect("192.168.0.21";"MyDB";"MyLogin";"MyPass")
connID:=MySQL_Connect("mydomain:3308";"MyDB";"MyLogin";"MyPass")
Note: When connecting to 4.1.X and 5.0.X MySQL databases servers:
Execute the following SQL statement from MySQL tool or another MySQL Client:
"SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('mypassw')".