Install MySQL using tar.gz method under Apple mac os x

伊谢尔伦
Release: 2023-03-02 21:16:01
Original
2341 people have browsed it

On Mac systems, to install MySQL Server, you usually use the DMG package and follow the prompts on the graphical interface. In addition, MySQL also provides the Compressed TAR Archive binary package installation method, which requires no installation and decompression of the runtime version. Compared with the DMG package, no installation is required. The versioning process is more concise, with pure command line operation, which is more in line with the tossing spirit of coders.

系统环境: OS X Yosemite 10.10.3
登录用户: wid (有 sudo 权限)
MySQL版本: 5.6.24 (mysql-5.6.24-osx10.9-x86_64.tar.gz)
MySQL下载: http://dev.mysql.com/downloads/mysql/
Copy after login

Find the location of the downloaded MySQL tar.gz file. The browser download is usually in the Downloads directory of the current user, that is, /Users//Downloads. Enter the terminal and decompress the tar.gz file:

cd /Users/<YourName>/Downloads
tar zxvf mysql-5.6.24-osx10.9-x86_64.tar.gz
Copy after login

Decompression completed Finally, you get the mysql-5.6.24-osx10.9-x86_64 directory, and move the decompression directory to the MySQL default installation path /usr/local/mysql. If the /usr/local path does not exist, create it with sudo mkdir /usr/local first.

# 移动解压后的二进制包到安装目录
sudo mv mysql-5.6.24-osx10.9-x86_64 /usr/local/mysql
# 更改 mysql 安装目录所属用户与用户组
cd /usr/local
sudo chown -R root:wheel mysql
# 执行 scripts 目录下的 mysql_install_db 脚本完成一些默认的初始化(创建默认配置文件、授权表等)
cd /usr/local/mysql
sudo scripts/mysql_install_db --user=mysql
Copy after login

Installation completed, test start, restart and stop:

cd /usr/local/mysql
# 启动
sudo support-files/mysql.server start
# 重启
sudo support-files/mysql.server restart
# 停止
sudo support-files/mysql.server stop
Copy after login

Initialize MySQL root password

cd /usr/local/mysql/bin
./mysqladmin -u root password <your-password>
Copy after login

Connect to the database through the built-in MySQL Client

cd /usr/local/mysql/bin
./mysql -u root -p
<your-password>
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template