Pages

Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Thursday, April 24, 2014

How to change root password of Mysql to an empty one or blank?


You should first restart the MySQL server or run the following command:
FLUSH PRIVILEGES;
 Now change the root password to an empty one:
mysqladmin -u root -p'<current password>' password ''
Now your password is updated to blank.

Fix String Encoding error with Mysql



The reason was apparently that the database (and especially the database tables) had the wrong character set. Switching the collation of the database alone did not help. Inspection of the database tables showed that each table still had the latin1 charset, which can not store all utf8 characters:
mysql> show table status;
+----------+--------+-------------------+ ..
| Name     | Engine | Collation         | ..
+----------+--------+-------------------+ ..
| my_table | InnoDB | latin1_swedish_ci | ..
Therefore I altered the character set of the table directly:
ALTER TABLE my_table CONVERT TO CHARACTER SET utf8;
Then it finally worked, and the character set is how utf8
   mysql> show table status;
    ... +-------------------+ ..
    ... | Collation         | .. 
    ... +-------------------+ ..
    ....| utf8_general_ci   | ..