1 configuration. emacs
(Setq SQL-mysql-options' ("-C" "-f" "-t" "-n"); for windows
(Setq SQL-user "root ")
(Setq SQL-password "")
2. Connect to the MySQL server
Execute M-x SQL-mysql/select SQL-> start SQLi session in the menu
Enter the user, password, mysql server address, port, and other information as prompted.
Emacs creates a buffer named * SQL *.
3. Connect the SQL file with * SQL * buffer
Open the SQL file and enter SQL-mode
Open the SQL file directly
Or
Open a file and execute M-x SQL-mode.
Set the product type to mysql
Select SQL> Product> MySQL from the ticket
Or
Execute M-x SQL-set-product and enter mysql
Connect the SQL file with * SQL * buffer
Use menu SQL> set SQLi buffer
Or
Execute the command M-x SQL-set-sqli-buffer
Enter the connection buffer to be connected. The default value is * SQL * buffer.
4. Use emacs as the mysql client
4.1 execute the SQL statement in * SQL * Buffer:
Enter the SQL statement directly, end with ";", and press enter to automatically execute
4.2 Execute SQL statements in the SQL File buffer
Enter an SQL statement, run all the statements in the current section according to C-c, or select the statement to be executed and press C-c C-B