


Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin
This article will take you step by step in the simplest way to install the mysql database on your mac computer and use phpMyAdmin to perform visual operations on the database. It is suitable for reading by novices who do not understand anything at all, and is also suitable for starting from a brand new mac The computer starts operating.
The first step is to install the mysql database.
Enter the official website of mysqlhttps://www.mysql.com/, click DOWNLOADS above , as shown in the picture below

Then scroll to the bottom and select

mysql is divided into enterprise version and community version. The enterprise version is charged, while the community version is free, so we just download the community version. After clicking in, click the place drawn below:

and then click in sequence:


After the download is completed, click Install, and you can keep clicking next until you reach the step below:

Select the button as shown in the picture and click Next to enter the following interface:

Here you need to set a mysql password yourself. This mysql password needs to be remembered. It is recommended to write it down in a memo or reminder ~ After setting the password Then click Continue until the installation is complete.
After the installation is completed, you can click on [System Preferences]. If you can see the mysql icon at the bottom, it means the installation is successful:
We click on the icon to enter the mysql interface, and then come to the interface shown in the picture below. Everyone should pay attention to drawing this address:

Next we open the mac terminal and enter
vim ~/.bash_profile
to enter a file. Switch the input method to English mode and tap the i letter on the keyboard. At this time, insert will be displayed at the bottom corner of the interface. Whether we use the scroll wheel or the down arrow key to scroll to the blank space below the file, write two sentences:
PATH="/usr/local/mysql/bin:${PATH}" # 注意这里的/usr/local/mysql就是上面图片划出来的地址,大家可以根据自己的情况复制进来这个地址,然后后面加上/bin:${PATH}就可以了,注意一些细节(引号、斜线) export PATH
After writing, click ESC on the keyboard in sequence, and then Enter: wq and press Enter (note the colon) to return to the main interface, and then enter
source ~/.bash_profile echo $PATH
. At this time, you only need to see /usr/local/mysql/bin displayed. Then enter mysql --version, you will get the version of mysql on the computer. At this time, we will actually complete the installation. Next we can use the mysql command to log in to the console. Enter
mysql -uroot -p
. You will be asked to enter your password. The password here is the mysql password you set when you installed mysql. Enter the mysql password. The screen will not display what you entered. content, but as long as you enter it correctly and press Enter, it will be verified. Getting the following interface means that everything is going well for you

At this point you can use the mysql command to operate the database. For example, if we enter show databases; all databases will be displayed.
The second step is to configure phpMyAdmin.
First open the terminal, enter
sudo vim /etc/apache2/httpd.conf
and press Enter. At this time, you will be asked to enter the password. This password is the password of your mac computer. After logging in, you will enter a file, still switch to the English input method, enter i, insert will appear in the lower left corner, and then use your smart eyes to find a sentence: #LoadModule php7_module libexec/apache2/libphp7. so After finding this sentence, remove the # in front of it, then still use ESC, :wq to return to the main interface, enter
sudo apachectl restart
回车。然后随意打开一个浏览器,在网址栏输入 http://localhost/ 。如果你看到了 It works! ,就说明你操作顺利了。
接下来下载phpMyAdmin。直接进入网址 https://www.phpmyadmin.net/downloads/ 然后下载:

下载完成后你会得到一个与图中同名的文件夹,然后依次操作:
首先,把这个文件夹移到桌面
其次,直接右键文件夹改名为phpmyadmin
然后,点进这个文件夹,找一个文件名叫config.sample.inc.php,先右键它改名为config.inc.php,再右键它选择打开方式为文本编辑,找到下面两句话并改成下面的形式:
$cfg['blowfish_secret'] = 'Cookie'; $cfg['Servers'][$i]['host'] = '127.0.0.1'; # 原来应该是host
然后保存后退出
最后一步,打开终端,输入:(根据评论区用户 @平凡的人 提示,有些朋友到这里可能会出现权限错误permission denied,则需要在指令前加上权限sudo)
sudo(或者)sudo -R chmod a+x mv /Users/(这里每个人不同)/Desktop/phpmyadmin /资源库/WebServer/Documents/
或者这句话:
sudo(或者)sudo -R chmod a+x mv /Users/(这里每个人不同)/Desktop/phpmyadmin /Library/WebServer/Documents/
这两句代码的意思是:把桌面的phpmyadmin文件夹移动到后面那个路径去,所以每个人mac电脑的名称应该是自己取的名字,你可以通过打开终端,输入cd Desktop/,然后输入 pwd 获取当前路径,再在后面加上/phpmyadmin就可以组成第一个路径了。sudo是开启权限,sudo -R chmod a+x是设置文件路径权限。
如果没有提示出错,就说明所有步骤都完成了!
这个时候就可以进入网址 http://localhost/phpmyadmin/ 用户名是root,密码是mysql密码,对你的mysql数据库进行可视化了~
写在最后:
这篇教程适合很多在这方面基础较差的小伙伴,只需要跟着步骤一步一步走就行了,很多步骤为什么这样写的原理我没有写,如果感兴趣的小伙伴可以自己去查阅有关资料...
推荐学习:《PHPmyadmin教程》
The above is the detailed content of Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

VS Code To switch Chinese mode: Open the settings interface (Windows/Linux: Ctrl, macOS: Cmd,) Search for "Editor: Language" settings Select "Chinese" in the drop-down menu Save settings and restart VS Code

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

How to back up VS Code configurations and extensions? Manually backup the settings file: Copy the key JSON files (settings.json, keybindings.json, extensions.json) to a safe location. Take advantage of VS Code synchronization: enable synchronization with your GitHub account to automatically back up all relevant settings and extensions. Use third-party tools: Back up configurations with reliable tools and provide richer features such as version control and incremental backups.

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version
