Monday, October 28, 2013

[MySQL] - Host 'xxx.xxx.x.xx' is not allowed to connect to this MySQL server

This problem happen when the mysql server doesn't allow remote connection. So first, go to the mysql server that you want to access.
  • Use putty (for windows) or terminal (for unix/linux) and perform the ssh
    ssh root@xxx.xxx.x.xx
    Enter password: (enter the server's password) 
  • Then type:
    mysql -u root -p
    Enter password:(enter the mysql password) 
  • Then type the following command:
    GRANT ALL PRIVILEGES ON *.* TO your_mysql_user@'%' IDENTIFIED BY 'your_mysql_password';
* make sure you change the value of your_mysql_user and your_mysql_password.Now you can access the mysql server through remote connection.

Friday, October 25, 2013

[Centos] - Yum with proxy

Just add the following on environment variable in .bash_profile file:

export http_proxy=http://ip:port

Now you can yum as usual.

Tuesday, October 1, 2013

[PHP] - Encode / Decode paramater on the URL using base64


function my_base64_encode($input) {
	return strtr(base64_encode($input), 'AEIOUj', '+-_,');
}
 
function my_base64_decode($input){
	return base64_decode(strtr($input, '+-_,', 'AEIOUj'));
}

$texttoencode = 'RAIHAN';

$b = my_base64_encode($texttoencode);
// the value of $b now is UkFJS-F,

$c = my_base64_decode($b);
// the value of $c is RAIHAN