Welcome Guest | Login

How to change a database's collation?

Hi,

what's the SQL command for changing the collation into utf8 for all the tables within a database?

i tried to do that in mysqladmin, but that only changed the collation of the database, no effect on the created tables. i can change one table in one time using: ALTER TABLE <tablename> DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

how do i do it in one go?

thanks.

2008-03-11 11:05 PM

Mryu - you won't be able to do this using mysqladmin from your console, since you only have restricted Jailshell access on a sherd server. But you can do this after logging into MySQl using your cPanel logins.

just type the command below  
#mysql -u accountusername -p

this will prompt you for password and you'll need to enter your cPanel password.

mysql> show databases;

will list all your databases.


ALTER DATABASE <db_name> DEFAULT CHARACTER SET utf8 COLLATE <collation name>

The command above should do the job for you.  

2008-03-12 12:46 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!