本文介绍在Mac环境使用PhpMyAdmin
1,启动Apache
在终端输入:sudo apachectl start
浏览器输入:“http://localhost” 显示It works!说明服务器已经启动成功了
#Mac自带了Apache环境,所以无需安装
2,配置一下PHP环境
终端输入:sudo vi /etc/apache2/httpd.conf
找到#LoadModule,php5_module libexec/apache2/libphp5.so,去掉#,键盘点击esc,然后写入并退出:wq
重启Apache:sudo apachectl restart
3,下载安装配置 PhpMyAdmin
下载:https://www.phpmyadmin.net
安装:将下载的文件夹解压放到 /Library/WebServer/Documents/ 目录下
配置:
cd /Library/WebServer/Documents/phpmyadmin/ // 进入phpmyadmin文件夹cp config.sample.inc.php config.inc.php //复制配置文件的模板vim config.inc.php //编辑配置文件$cfg['blowfish_secret'] = '输入字符串'; //用于Cookie加密$cfg['Servers'][$i]['host'] = '127.0.0.1'; //MySQL守护程序做了IP绑定
以上步骤完成之后,在浏览器中输入http://localhost/phpmyadmin/即可
4,问题及对策
问题:
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
对策:
use mysql
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘你的密码’;
FLUSH PRIVILEGES;
