How To Install MySQL On Mac With Apple M1 Chip? - A Step-By
How To Install MySQL On Mac With Apple M1 Chip? - A Step-By
Table of Contents
How to install MySQL on Mac with Apple M1
chip? Step 1: Install Homebrew
The official MySQL documentation points you towards using the Native Package, which Share this article:
Based on my experience, I suggest we bypass that route and go with a smoother, more
user-friendly approach.
$ Subscribe
We'll utilize the wonderful Homebrew package manager, which simplifies everything from Skip the coding hassle!
Get analytics reports and
installing MySQL to future upgrades and database migrations. presentations in Minutes! No
coding needed, just instant
results.
Ready to dive in? Let's get started. GRAB YOUR FREE ANALYTICS REPORT NOW!
Visit https://brew.sh/ to follow the step-by-step instructions, or copy and paste the
following command into your terminal (iTerm 2 you just installed).
Copy
Homebrew will always search for the latest version of a formula; as of Nov 7, 2023, the
latest MySQL version is 8.1.0
After a few seconds, you should see a success and instructions message.
To connect run:
mysql -u root
The MySQL server will automatically run in the background when you restart your Mac.
Copy
1 mysql -u root
mysql is a command-line utility that was installed together with the MySQL server, -
u specifies which user to login. By default, you, as the admin of your machine, can log in
as a 'root' user.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
You can run some basic commands to find existing default databases and tables
Copy
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
Copy
Database changed
Copy
+------------------------------------------------------+
| Tables_in_mysql |
+------------------------------------------------------+
| columns_priv |
| component |
| db |
| default_roles |
| engine_cost |
| func |
| general_log |
| global_grants |
| gtid_executed |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_index_stats |
| innodb_table_stats |
| password_history |
| plugin |
| procs_priv |
| proxies_priv |
| replication_asynchronous_connection_failover |
| replication_asynchronous_connection_failover_managed |
| replication_group_configuration_version |
| replication_group_member_actions |
| role_edges |
| server_cost |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+------------------------------------------------------+
37 rows in set (0.00 sec)
First, we need to locate the file in your command line, and type the following in your
terminal.
Copy
Copy
You can search MySQL fine tuning on google and read more details:
For example:
https://haydenjames.io/mysql-8-sample-config-tuning/
https://github.com/Releem/awesome-mysql-performance
https://severalnines.com/blog/mysql-performance-cheat-sheet/
Copy
Copy
1 [mysqld]
2 disable-log-bin = 1
3 skip-name-resolve = 1
4 performance-schema = 0
5 local-infile = 0
6 mysqlx = 0
7 bind-address = [IPs removed]
8 default-storage-engine = InnoDB
9 open_files_limit = 200000
10 max_allowed_packet = 256M
11 sql_mode = "STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
12
13 innodb_dedicated_server = 1
14 innodb_buffer_pool_instances = 48
15 innodb_log_buffer_size = 64M
16 innodb_read_io_threads = 12
17 innodb_write_io_threads = 12
18 innodb_stats_on_metadata = 0
19 innodb_file_per_table = 1
20
21 max_connections = 500
22 thread_cache_size = 128
23 table_definition_cache = 65536
24 table_open_cache = 65536
25
26 wait_timeout = 10
27 connect_timeout = 5
28 interactive_timeout = 30
29
30 tmp_table_size = 128M
31 max_heap_table_size = 128M
32
33 read_buffer_size = 256K
34 join_buffer_size = 1M
35 sort_buffer_size = 512K
36 read_rnd_buffer_size = 512K
37
38 slow-query-log = 1
39 long_query_time = 2
40 slow_query_log_file = /var/log/mysql_slow_query.log
41 log-error = /var/log/mysql/db.[removed].com.err
Source: https://haydenjames.io/mysql-8-sample-config-tuning/
Finally, we need to save the file and restart the MySQL server:
Copy
Since many variables impact the performance of your MySQL server and explaining those
factors is beyond the scope of this article, if you are interested to know more, please feel
free to read the following articles:
https://severalnines.com/blog/mysql-performance-cheat-sheet/
Eager to experiment with MySQL without installing on your machine? Dip your toes into
SQLPad's MySQL Playground, where you can play with real data, completely free of
charge.
PostgreSQL vs MySQL
SQL 6 Jan 2024 SQL 13 Jan 2024
Explore an in-depth comparison of PostgreSQL
vs. MySQL. Understand their histories,
How to install Postgres on a Mac M1 Top SQL IDEs in 2024
architectures, performance metrics, and ideal
with Homebrew in 5 minutes Discover the top 11 SQL IDEs in 2024 for data use-cases.
Effortlessly install Postgres 14 on Apple Silicon engineers, with detailed analysis of features,
(M1, M2, M3) Macs using Homebrew. This guide pros, cons, and pricing to help you choose the
includes configuration tips for enhanced perfect to
performance.