-
- Item
- 24 March 2011
- Jaymon
get around not having "if exists" to add users in an init script mysql #db #mysql #learned
"A good workaround is to grant a harmless privilege to the user before dropping it. This will create the user if it doesn't exist, so that it can be dropped safely, like so: GRANT USAGE ON *.* TO 'username'@'localhost'; DROP USER 'username'@'localhost'; " via: http://bugs.mysql.com/bug.php?id=19166
-
- Item
- 3 March 2011
- Jaymon
Mysql changing a column type #mysql #learned
ALTER TABLE tbl_name CHANGE field_name field_name field_type; so, to change the username field on the table user to TEXT: ALTER TABLE user CHANGE username username TEXT; http://www.roseindia.net/sql/mysql-alter/mysql-alter-column-datatype.shtml
-
- Item
- 3 March 2011
- Jaymon
the queries you need to run to update your mysql db and tables to utf-8 #db #mysql #learned
you need to run this query for the db: ALTER DATABASE db_name CHARACTER SET utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT COLLATE utf8_general_ci ; and then these 2 queries for each table in that db: ALTER TABLE table_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; ALTER TABLE table_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; via: http://web.archive.org/web/20070605215105/http://www.nicknettleton.com/zine/php/php-utf-8-cheatsheet some other links that were helpful http://www.joelonsoftware.com/articles/Unicode.html http://stackoverflow.com/questions/140728/best-practices-in-php-and-mysql-with-international-strings more stuff: http://marcyes.com/2009/12/21/php_utf8_cheatsheet/
-
- Item
- 7 February 2011
- Jaymon
mysql get set variable value #mysql #learned #db
If you want to know what value your mysql currently has for a given variable, you can do in the mysql commmand line: $ show variables where variable_name='VALUE'; so, if you want to see how long innodb will wait for a lock: $ show variables where variable_name='innodb_lock_wait_timeout'; And to see all variables, you can: $ show variables;