Automation: Creating UTF-8 MySQL Databases and Users via Python

When provisioning new web applications or services, setting up clean UTF-8 databases and isolating access permissions to dedicated application users is a routine administrative task. Using the proper character set (utf8mb4 in modern MySQL, or utf8 in legacy environments) prevents multi-byte character encoding errors and collation mismatches. The Standard SQL Provisioning Queries The standard sequence to create an application database with UTF-8 support and grant least-privilege permissions to a dedicated user is: ...

November 24, 2014 · 2 min · 357 words · Ahmad Mahfouz

Resetting MySQL and MariaDB Root Passwords

Locked out of MySQL with ERROR 1045 (28000): Access denied for user 'root'@'localhost'? When root credentials are lost or desynchronized, you cannot change the password while the daemon enforces standard privileges. You must restart the database daemon in a bypass mode, update the authentication tables, and restart the service normally. Here are two reliable methods to recover access. Method 1: Using --skip-grant-tables This method starts the daemon without reading the grant tables, allowing local root login without a password. ...

November 24, 2014 · 2 min · 234 words · Ahmad Mahfouz