Add a new MySQL user
Here's how to create a new MySQL user. This user will need to be given privelages to your tables and databases at a later time.
Batch files in mysql
This is the command for executing a batch file in mysql.
To run manually, you can use the mysql command-line, then type the code below
(note: this example is on windows platform - change the slashes for i/ux)
Change Column (Field) Parameters
Let´s say you want to lengthen one of your MySQL fields. Here´s how to do it:
Here, we are changing the field length to 20 (no matter what the previous length was).
Character Returns with PHP
ISSUE: Carriage returns going in, turn out on 1 line when displayed.
RESOLUTION: Format your line breaks by replacing
"/n" with ´< br >´ and on the way out, do the reverse:
Take a look:
Comments in MySql
Use the following syntax to include comments in your SQL code for MySql:
#xyz
OR
/* xyz */
Disable STRICT mode
Here's how to disable Strict mode in MySql.
This can be useful when working with bulk inserts whose data doesn't explicitly comply with existing DB format.
Disable STRICT mode
Here's how to disable Strict mode in MySql.
This can be useful when working with bulk inserts whose data doesn`t explicitly comply with existing DB format.
Grant User Rights Syntax
Grant privelages to your MySQL users with the following syntax.
Common functions(privelages) include:
ALL PRIVILEGES
FILE
RELOAD
ALTER
INDEX
SELECT
CREATE
INSERT
SHUTDOWN
DELETE
PROCESS
UPDATE
DROP
REFERENCES
USAGE
MySql database dump
drop this into a batch file (.bat) and schedule it to run. it will create a backup and error log of your mysql database.
MySQL System Functions
Here are some useful functions for obtaining information about MySQL. Most examples are in PHP.
Transactional MySql in PHP
Run MySql Transactions from PHP
Here's how you can run multiple queries, and rollback the transaction on failure of any single query.