标签:main start osx 工具 work lib password 删除mysql tar
偷个懒,用的系统自带的apache和php
我是下载的tar包版本,解压之后的操作步骤如下
# 将文件夹移到/usr/local下
sudo mv mysql-8.0.13-macos10.14-x86_64/ /usr/local/mysql
# 修改用户用户组
sudo chown -R root:wheel /usr/local/mysql
# 初始化,注意记录临时root密码
/usr/local/mysql/bin/mysqld --initialize --user=mysql
# 测试启动,重启,停止,检查状态
cd /usr/local/mysql
sudo support-files/mysql.server start
sudo support-files/mysql.server restart
sudo support-files/mysql.server stop
sudo support-files/mysql.server status
# 修改root密码
mysqladmin -u root -p password root123
# 登录mysql
mysql -u root -p
# 输出密码
# 成功如下
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.13 MySQL Community Server - GPL
#其他修改root密码的方式
# 用set password命令
mysql> set password for root@localhost = password(‘123‘);
# 直接UPDATE编辑user表
mysql> use mysql;
mysql> update user set password=password(‘123‘) where user=‘root‘ and host=‘localhost‘;
mysql> flush privileges;
# 修改PATH环境变量
PATH=$PATH:/usr/local/mysql/bin
是C/S架构,通过客户端,或者通过一些扩展插件
php本身不具备操作MySQL的能力,需要借助MySQL的扩展实现
$ phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
---------------------
上面问题的解决办法
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/php /usr/include/php
如果sudo还是没有权限是因为rootless机制,锁定了/system、/sbin、/usr
重启之后Command+R,实用工具-Terminal-csrutil disable
$ phpize
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
这个问题用brew install autoconf即可
./configure
make
make test
sudo cp module/mysql.so /usr/lib/php/no-debug-non-zts-20160303
extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/mysql.so
标签:main start osx 工具 work lib password 删除mysql tar
原文地址:https://www.cnblogs.com/logchen/p/10346272.html