1、解压压缩包
sudo tar -zxvf mysql-8.0.32-macos13-arm64.tar
2、移动到想要安装的目录
cd /Library mkdir mysql
sudo mv mysql-8.0.32-macos13-arm64 /Library/mysql/
3、配置环境变量(1、3是命令。2、4是需要编辑的内容)
sudo vim ~/.bash_profile
export MYSQL_HOME=/Library/mysql/mysql-8.0.32-macos13-arm64 export PATH=$MYSQL_HOME/bin:$MYSQL_HOME/support-files:$PATH
sudo vim ~/.zshrc
source ~/.bash_profile
3.1、最后重新启动用户环境变量
source ~/.bash_profile
4、修改mysql启动文件
sudo vim /Library/mysql/mysql-8.0.32-macos13-arm64/support-files/mysql.server
4、注意(有不一样的才改,往下不到一会二就可以看到这里的代码,主要就是改成自己的安装路径)
# Set some defaults
mysqld_pid_file_path=
if test -z "$basedir"
then
basedir=/Library/mysql/mysql-8.0.32-macos13-arm64
bindir=/Library/mysql/mysql-8.0.32-macos13-arm64/bin
if test -z "$datadir"
then
datadir=/Library/mysql/mysql-8.0.32-macos13-arm64/data
fi
sbindir=/Library/mysql/mysql-8.0.32-macos13-arm64/bin
libexecdir=/Library/mysql/mysql-8.0.32-macos13-arm64/bin
else
5、初始化密码(密码在执行之后在root@localhost:*****)的后面
sudo mysqld --initialize --user=mysql
6、启动mysql
sudo mysql.server start
7、后面操作(然后输入刚刚初始化的密码)
mysql -u root -p
写作不易,成功后点个赞,谢谢
标签:8.0,32,Library,mac,arm64,mysql,macos13,压缩包 From: https://www.cnblogs.com/bohong/p/17134143.html