


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











MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

The system architecture of macOS includes hardware abstraction layer, XNU core, I/OKit, core services and Aqua user interface. Core components include the startup process, the APFS file system, and SystemIntegrityProtection. Performance optimization and best practices involve hardware configuration, software setup, and development skills.

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

MySQL and phpMyAdmin can be effectively managed through the following steps: 1. Create and delete database: Just click in phpMyAdmin to complete. 2. Manage tables: You can create tables, modify structures, and add indexes. 3. Data operation: Supports inserting, updating, deleting data and executing SQL queries. 4. Import and export data: Supports SQL, CSV, XML and other formats. 5. Optimization and monitoring: Use the OPTIMIZETABLE command to optimize tables and use query analyzers and monitoring tools to solve performance problems.

The basic operations of macOS include starting applications, managing files, and using system settings. 1. Start the application: Use the Terminal command "open-aSafari" to start the Safari browser. 2. Manage files: browse and organize files through Finder. 3. Use system settings: understand the functions of Dock and Launchpad to improve operational efficiency. Through these basic operations, you can quickly master how to use macOS.

Key features of macOS include Continuity, APFS, Siri, powerful security, multitasking, and performance optimization. 1.Continuity allows seamless switching of tasks between Mac and other Apple devices. 2. APFS improves file access speed and data protection. 3.Siri can perform tasks and find information. 4. Security functions such as FileVault and Gatekeeper to protect data. 5. MissionControl and Spaces improve multitasking efficiency. 6. Performance optimization includes cleaning caches, optimizing startup items and keeping updates.
