search
HomeDatabasephpMyAdminTeach 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 mysqlmysql.com/, click DOWNLOADS above , as shown in the picture below

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

Then scroll to the bottom and select

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

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:

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

and then click in sequence:

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin
Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

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

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

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

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

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:

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

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

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

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/ 然后下载:

Teach you step by step how to install mysql on Mac and visualize it with phpMyAdmin

下载完成后你会得到一个与图中同名的文件夹,然后依次操作:

首先,把这个文件夹移到桌面

其次,直接右键文件夹改名为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!

Statement
This article is reproduced at:zhihu. If there is any infringement, please contact admin@php.cn delete
phpMyAdmin: A Web-Based Interface for Database ManagementphpMyAdmin: A Web-Based Interface for Database ManagementApr 27, 2025 am 12:20 AM

phpMyAdmin is a web-based tool for managing MySQL and MariaDB databases. 1) It provides an intuitive user interface that allows various database operations through the browser. 2) phpMyAdmin interacts with the database through PHP scripts and converts operations into SQL commands. 3) Users can perform operations from basic data browsing and editing to advanced SQL queries and view management. 4) Common problems include connection failures and SQL syntax errors, which can be solved by checking configuration and syntax. 5) Performance optimization suggestions include avoiding large-scale data operations during peak periods and regularly maintaining databases.

phpMyAdmin: Managing Tables, Databases, and UsersphpMyAdmin: Managing Tables, Databases, and UsersApr 26, 2025 am 12:01 AM

phpMyAdmin can be used to manage tables, databases, and users. 1) Create a table: Create a table named users through the interface, including id, username and email fields. 2) Export database: Export the structure and data of my_database and its users table. 3) Manage users: Create a new user and grant them all permissions to my_database.

Using phpMyAdmin: A Guide for Database AdministratorsUsing phpMyAdmin: A Guide for Database AdministratorsApr 25, 2025 am 12:12 AM

phpMyAdmin is a web-based MySQL database management tool that provides an intuitive interface to manage databases. 1. It allows creating, modifying, deleting databases and tables, executing SQL queries, importing and exporting data, performing user management and permission settings. 2. By establishing a connection with the MySQL server, phpMyAdmin converts user requests into SQL commands and executes them. 3. The basic usage includes viewing table data, and the advanced usage supports complex SQL queries. 4. Common errors such as connection failure and query syntax errors can be debugged by checking the server status and using the SQL editor. 5. Performance optimization can be achieved by creating indexes for common fields, regularly backing up the database, and keeping the structure neat.

Understanding the Relationship: MySQL and phpMyAdminUnderstanding the Relationship: MySQL and phpMyAdminApr 24, 2025 am 12:05 AM

The relationship between MySQL and phpMyAdmin is that MySQL stores data, and phpMyAdmin manages this data through the HTTP protocol. 1.MySQL is an open source relational database management system that supports a variety of operating systems and project requirements. 2.phpMyAdmin is a web-based tool that provides an intuitive interface to manage MySQL databases, and supports SQL queries and data import and export. 3.phpMyAdmin communicates with the MySQL server by generating SQL queries, and users can operate the database through the interface. 4. Use phpMyAdmin to create databases and tables, execute queries, import and export data, and support advanced features such as optimized queries and management permissions.

phpMyAdmin and MySQL: The Perfect CombinationphpMyAdmin and MySQL: The Perfect CombinationApr 23, 2025 am 12:04 AM

phpMyAdminandMySQLtogetherenhancedatabasemanagementbyprovidingeaseandefficiency.1)phpMyAdminoffersauser-friendlyinterfaceformanagingMySQLdatabases,2)itallowsforeasyexecutionofSQLqueries,import/exportofdatabases,andmanagementofuserpermissions,3)itaids

MySQL and phpMyAdmin: Core Features and FunctionsMySQL and phpMyAdmin: Core Features and FunctionsApr 22, 2025 am 12:12 AM

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.

phpMyAdmin: Generating and Executing SQL QueriesphpMyAdmin: Generating and Executing SQL QueriesApr 21, 2025 am 12:03 AM

The methods of generating and executing SQL queries in phpMyAdmin include: 1. Enter the query in the SQL tab and click to execute; 2. Use JOIN to merge table data; 3. Use index and LIMIT when optimizing queries. phpMyAdmin simplifies database management through an intuitive interface, supporting SQL query operations from basic to advanced.

MySQL and phpMyAdmin: How They Work TogetherMySQL and phpMyAdmin: How They Work TogetherApr 20, 2025 am 12:05 AM

We need to combine database management with a user-friendly interface because this can improve efficiency and convenience. 1) MySQL handles complex data storage and queries, 2) phpMyAdmin provides intuitive web interface to simplify management, 3) The two collaborate to implement data operations through SQL commands, and 4) phpMyAdmin displays the results in a user-friendly way.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment