This section describes the LIBNAME statements that SAS/ACCESS Interface to MySQL supports. For general information about this feature, see LIBNAME Statement for Relational Databases.
Here is the LIBNAME statement syntax for accessing MySQL.
For general information about the LIBNAME statement that is not specific to SAS/ACCESS, see LIBNAME Statement in SAS Global Statements: Reference.
specifies any SAS name that serves as an alias to associate SAS with a database, schema, server, or group of tables.
mysqlspecifies the SAS/ACCESS engine name for MySQL interface.
provide connection information and control how SAS manages the timing and concurrence of the connection to the DBMS. Here is how these options are defined.
specifies the MySQL user logon ID. If this argument is not specified, the current user is assumed. If the user name contains spaces or nonalphanumeric characters, you must enclose the user name in quotation marks.
specifies the MySQL password that is associated with the MySQL logon ID. If the password contains spaces or nonalphanumeric characters, you must enclose the password in quotation marks.
specifies the MySQL database to which you want to connect. If the database name contains spaces or nonalphanumeric characters, you must enclose the database name in quotation marks.
specifies the server name or IP address of the MySQL server. If the server name contains spaces or nonalphanumeric characters, you must enclose the server name in quotation marks.
specifies the port used to connect to the specified MySQL server.
Default: 3306
specify how SAS processes DBMS objects. Some LIBNAME options can enhance performance, and others determine locking or naming behavior. The following table describes the LIBNAME options for SAS/ACCESS Interface to MySQL, with the applicable default values. This table also identifies LIBNAME options that are valid in the CONNECT statement in the SQL procedure. For more information, see LIBNAME Options for Relational Databases.
|
Option |
Default Value |
Valid in CONNECT |
|---|---|---|
|
none |
|
|
|
none |
● |
|
|
YES |
● |
|
|
temporary file directory that is specified by the UTILLOC= system option |
● |
|
|
NO |
● |
|
|
NO |
● |
|
|
SHAREDREAD |
● |
|
|
none |
● |
|
|
SAS session encoding |
|
|
|
1000 (when inserting rows), 0 (when updating, deleting, or appending rows to an existing table) |
|
|
|
none |
● |
|
|
none |
● |
|
|
none |
|
|
|
DBMS |
● |
|
|
NO |
|
|
|
none |
|
|
|
none |
|
|
|
1024 |
● |
|
|
NO |
|
|
|
NO |
● |
|
|
COMPAT |
|
|
|
caching_sha2_password |
||
|
NO |
● |
|
|
none |
|
|
|
YES |
|
|
|
NO |
|
|
|
1 |
|
|
|
NONE |
|
|
|
YES |
|
|
|
YES |
|
|
|
none |
|
|
|
NO |
● |
|
|
MEMORY |
|
|
|
DBMS specific |
|
|
|
YES |
|
|
|
none |
|
|
|
none |
|
|
|
none |
|
|
|
none |
|
|
|
none |
|
|
|
none |
|
|
|
NO |
|
In the following example, the libref MYSQLLIB uses SAS/ACCESS Interface to MySQL to connect to a MySQL database. The SAS/ACCESS connection options are USER=, PASSWORD=, DATABASE=, SERVER=, and PORT=.
libname mysqllib mysql user=myusr1 password=mypwd1 database=mysqldb
server=mysrv1 port=9876;
proc print data=mysqllib.employees;
where dept='CSR010';
run;