Built-in apps

MySQL

16min
mysql is an open source relational database management system with the mysql app in {{product name}} , you can run your custom logic directly on your database server through stored procedures {{product name}} loads the interface of input and output parameters and record sets dynamically so each parameter/value can be mapped individually requirements to use the mysql app in {{product name}} , you must have a mysql server connection and a configured mysql server connect mysql and {{product name}} to get started, you must first create a connection between mysql and {{product name}} , allowing the two services to communicate to create the connection, you need to mysql docid\ lrghwt5k6gxjpe7xv brc mysql docid\ lrghwt5k6gxjpe7xv brc configure your mysql server remote access must be allowed, and the create routine privilege must be granted on the mysql server set the read access to mysql tables make sure the account you are using to connect to your database has read access to the information schema tables , information schema columns , information schema routines , and information schema parameters tables allow connections to and from {{product name}} ip addresses make will make connections to your database from the allow connections to and from make ip addresses docid\ d0fwd60kzrvcj9b0ozriy our servers are set up with valid ptr records, so you can easily restrict access by allowing % make com enable access on your firewall enable incoming tcp connections to port 3306 from source ip addresses configure mysql for remote access linux open the configuration file /etc/mysql/my cnf comment outline bind address = 127 0 0 1 (by adding a hash at the beginning of the line) #bind address = 127 0 0 1 restart the mysql daemon create and grant remote access to your mysql account start the mysql command line interface mysql u root p execute these commands (with \<database> , \<user> and \<password> replaced by actual values) create user \&lt;user\&gt;@'%' identified by \&lt;password\&gt; grant all privileges on \&lt;database\&gt; to \&lt;user\&gt;@'%' identified by \&lt;password\&gt; with grant option; flush privileges; set the tolerance of non interactive connection {{product name}} processes {{scenario plural lowercase}} transactionally that's why all {{product name}} modules that support transactions have open transactions throughout the whole run of a {{scenario singular lowercase}} therefore, make sure that you have set a long enough time to tolerate non interactive connections this mysql command will list the values show variables like 'wait timeout'; see more information in the mysql documentation on server system variables create a connection in {{product name}} once you have configured your mysql server, you're ready to create the connection in {{product name}} to create the connection log in to your {{product name}} account, add a mysql module to your {{scenario singular lowercase}} , and click create a connection optional in the ​​ connection name​​ field, enter a name for the connection complete the following fields field description connection name enter the name of the new mysql connection you want to establish host enter the address of the mysql server the mysql server must be publicly accessible from the internet if you want to use the database hosted on your local server, you'll need to specify your public ip address, and set the port forwarding on your router do not enter "localhost , " or "127 0 0 1" in this field, as it will not work port enter the port number of the mysql server database enter the database name if needed this is required for the execute a query (advanced) module user enter the mysql server user name password enter the password allow insecure authentication enable this option to connect to mysql instances that use the old authentication method (mysql 4 0 and older) if needed, see additional information about updating old authentication protocol passwords charset (optional) enter the mysql character set for the connection, e g , utf8 in this case, the utf8 general ci mysql collation is used self signed certificate (optional) upload your certificate ( p12, pfx, or pem file) if you want to use tls using your self signed certificate if you're using the client side certificate authorization, you can enter your ca certificate here {{product name}} does not retain or store any data (files, passwords) you provide file and password are only used to extract a private key/certificate client private key (optional) upload the private key to use the client side certificate authorization {{product name}} does not retain or store any data (files, passwords) you provide file and password are only used to extract a private key/certificate client certificate (optional) upload your certificate if you want to use client side certificate authorization {{product name}} does not retain or store any data (files, passwords) you provide file and password are only used to extract a private key/certificate click save if prompted, authenticate your account and confirm access you've successfully created the connection and can now use the mysql app in your {{scenario plural lowercase}} if you want to make changes to your connection in the future, follow the steps connect an application docid\ so88fm6pkt0g adkddfzz mysql modules after connecting to the mysql app, you can use the following types of modules to build your {{scenario plural lowercase}} actions delete row(s) from a table deletes a row according to a defined filter field description connection establish a connection to the mysql server table select the table where you want to delete the row filter set the filter for the row to be deleted set filter values you can also use logical operators, and/or, to specify your selection execute a query (advanced) field description connection establish a connection to the mysql server query enter the desired mysql query make sure that the database field under connection settings is filled variables used in the query are not sanitized make sure you sanitize variables properly to prevent sql injection continue the execution of the route even if the module returns no results if enabled, the {{scenario singular lowercase}} will not be stopped by this module only one sql statement is allowed (one semicolon ; as a statement terminator per query) execute a stored procedure field description connection establish a connection to the mysql server stored procedure select the stored procedure you want to execute the stored procedure must already be created here is a sample sql statement that creates a stored procedure that simply inserts the values passed in the three parameters into a table delimiter ;; create procedure `insert record from integromat`(in name text, in email text, in phone text) begin insert into contacts (name, email, phone) values ( name, email, phone); end;; fields contains the parameter fields from the stored procedure e g , enter values you want to insert into the table during the stored procedure execution example the following example adds 2 to the provided parameter (e g , in the execute a stored procedure module), and returns the result, together with the current date (can be further iterated using the iterate recordset of a stored procedure module) create procedure `test procedure`(in id integer, out outid integer) begin set outid = id + 2; select id as inid, now() as current date; end$$ insert row into a table inserts a row with the desired values into a selected table field description connection establish a connection to the mysql server table select the table where you want to add a row column name(s) enter the desired values that will be inserted into the new row to pass a null value, use an insert statement using the mysql docid\ lrghwt5k6gxjpe7xv brc module for more information, refer to mysql docid\ lrghwt5k6gxjpe7xv brc insert row update row(s) in a table updates rows (can be defined by the filter settings) in the selected table field description connection establish a connection to the mysql server table select the table where you want to update a row c olumn name(s) enter the desired values that will be inserted into the rows filter set the filter to define which rows will be updated to pass a null value, use an insert statement using the mysql docid\ lrghwt5k6gxjpe7xv brc module for more information, refer to mysql docid\ lrghwt5k6gxjpe7xv brc pass null values into a table as of now, it is not possible to pass null values in our standard modules, insert/update row(s) into a table even using the null pill to achieve this, you need to use the execute a query (advanced) module where you prepare a full sql statement (either insert or update) as a workaround as shown in the example you need to update an existing row in your database with three columns name, email, and phone number you want to update a contact and set the contact's phone to null based on the contact’s email address to achieve that, use this statement `update yourtablenamehereset name='joe doe',email='joe\@doe com',phone=nullwhere email='joe\@doe com'` in your {{scenario singular lowercase}} , map the email address (and the name possibly too) from preceding modules and ensure the mapped pills are in single quotes searches select row(s) from a table selects a row from a table according to a defined filter field description connection establish a connection to the mysql server table select the table you want to select a row from filter set the filter for the row to be selected set filter values you can also use logical operators, and/or, to specify your selection in the following mysql dialog, the row that contains number 1 or 2 in the "column1" column will be selected continue the execution of the route even if the module returns no results if enabled, the {{scenario singular lowercase}} will not be stopped by this module you may also use the existing basic text operators for comparing dates and datetimes just use text formatted date/datetime as the second operand yyyy mm dd for date type yyyy mm dd hh\ mm\ ss for datetime type literal static datetime value example formatted dynamic datetime value example iterators iterate recordset of a stored procedure field description source module select the source module containing the stored procedure recordset you want to iterate troubleshooting mysql error er not supported auth mode client does not support authentication protocol requested by server; consider upgrading mysql client mysql 8 uses an authentication method that is not supported by {{product name}} yet solution use the mysql native password plugin to make the account fall back to the "traditional" process during the handshake, keeping compatibility by default for any previously supported server version create the account using the mysql native password authentication plugin create user 'new user'@'%' identified with mysql native password by 'user password'; or, modify the existing user account, and specify the mysql native password authentication plugin alter user 'root'@'localhost' identified with mysql native password by 'yourrootpassword'; (reference https //github com/mysqljs/mysql/issues/2046#issuecomment 396039909 ) error er lock wait timeout lock wait timeout exceeded; try restarting transaction this error occurs when you modify the same data using multiple modules it is caused by sql transactions when any mysql module is executed, then it starts the transaction (1), and the transaction is finished after the {{scenario singular lowercase}} is fully executed if another module tries to access the same data used in another unfinished transaction (1), then it has to wait until the previous transaction (1) is finished this, however, never happens because the first transaction (1) will be finished when the {{scenario singular lowercase}} is finished solution turn on auto commit it finishes (commits) every transaction immediately after the module execution is done open the {{scenario singular lowercase}} settings enable the auto commit checkbox click ok to confirm the settings