Error while accessing site with special characters. Update collation for database.

I was getting the error while acccessing the http://yourdomainname/collat.php as below -

Error while accessing site with special characters. Update collation for database.

Solution :-

1. Create one collation file in the user account with the ".php" extension. Eg. collat.php
Note : Create the file in public_html or any recommended script path.

2. Write following code in the file :

<?php
$db = mysql_connect('hostname','database_user','database_password');
if(!$db) echo "Cannot connect to the database - incorrect details";
mysql_select_db('database_name'); $result=mysql_query('show tables');
while($tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $value) {
mysql_query("ALTER TABLE $value COLLATE database_collation");
}}
echo "The collation of your database has been successfully changed!";
?>
Note : Replace the database name, username and password in the above code with the collation you wish to set.

3. Change the permission and ownership of the file -

> chmod 644 collat.php
> chown user.user collat.php

4. Save the file and run the URL as: http://yourdomainname/collat.php.
Once the file get run it will set collation for the database present in the collat.php file.

Note : It is only for single database at a time. For another database just delete the previous code from the collate.php file and change it to another database details and run the http://yourdomainname/collat.php

Was this answer helpful?

 Print this Article

Also Read

How to resolve the issue of WordPress site which downloads PHP files instead of parsing after cPanel migration?

After migrating the WordPress site on the cPanel server, the website was not loading, it was...

Host1 uid 32210 no header by parse_headers so taking whole header with BODY.PEEK[HEADER]

I was getting below error messages while using imapsync command on the server and emails were not...

MySQL Error 28 - WordPress Error

While accessing the WordPress site and dashboard, I was getting the error as 'MySQL Error 28'....

A DNS entry for 'domain_name' already exists. You must remove this DNS entry from all servers in the DNS cluster to proceed.

While adding addon domain under cPanel, I was getting error as below - A DNS entry for...

How to Re-arrange accounts in WHM?

Please go through the following steps on How to Re-arrange accounts in WHM 1. Go to WHM and...

Powered by WHMCompleteSolution