Friday, November 23, 2018

Fix ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%' when using MySQL 8


1. Connet to MySQL DB:
mysql -u user -pPASSWORD
 
2. Just Run the following command:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';

Fix mysqli_real_connect(): (HY000/2002): No such file or directory

1. When trying to access http://localhost/phpmyadmin, following messafe is displayed:
mysqli_real_connect(): (HY000/2002): No such file or directory

2. In order to fix, edit config.inc.php
vi config.inc.php

3. Replace
$cfg['Servers'][$i]['host'] = 'localhost';
with
$cfg['Servers'][$i]['host'] = '127.0.0.1';


After this change, it works!

Install MySQL on MAC OSX and integrate with Apache PHP

1. Download and install MySQL DMG package

https://dev.mysql.com/downloads/mysql/


2. Make sure PHP and MySQL work together:

cd /var mkdir mysql cd mysql ln -s /tmp/mysql.sock mysql.sock



3. Add PATH to include MySQL:

export PATH=/usr/local/mysql/bin:$PATH

4. Download PHPMyAdmin latest version from here:

https://www.phpmyadmin.net/
 

5. Install phpmyadmin under default Apache folder:

cd /Library/WebServer/Documents/ 

cp /Users/myuser/Downloads/phpMyAdmin-4.8.3-all-languages.zip .
unzip phpMyAdmin-4.8.3-all-languages.zip 
mv phpMyAdmin-4.8.3-all-languages phpmyadmin 
cd phpmyadmin 
mv config.sample.inc.php config.inc.php

6. Access http://localhost/phpmyadmin