Step-by-step instructions for installing MySQL on macOS using Homebrew
On macOS, you can easily install MySQL with the following commandHouse wine.
brew install mysql
The above command should take some time, and then print the following:
Now, you can start the MySQL server by running the following command:
brew services start mysql
Now we need to protect the MySQL server. By default, the server does not have a root password, so we need to make sure it is protected.
This process may take some time, but it ensures that you can get the best default settings immediately:
Because we use
brew services start mysqlTo start MySQL, your Mac will restart it when it restarts. You can run:
brew services stop mysql
To prevent this from happening, and immediately stop MySQL.
You can also avoid thisDaemon mode(This is what we call a program that always runs in the background and restarts when the computer restarts) by running:
This will start MySQL and keep it running until the computer is shut down or running:
And it will not restart it on reboot.
It is up to you to decide which one to choose.
Now you can connect to the server using the following command:
mysql -u root -p
You will need to enter
rootuser passwordRearYou run this command and when finished, you will see the following screen:
The excellent GUI (graphics) software we can use to interact with the SQLite database is TablePlus.
It comes with a free trial version, which is very suitable for our use, because it is not based on time, but limits the number of concurrent connections you can establish with the database.
Download fromhttps://tableplus.com. I know there are macOS, Windows and Linux versions.
Click "Create a new connection..." and select MySQL in the list:
Then set a name for the connection, then enter "root" and the previously set password:
Connect, You should be connected to MySQL!
Please note that we use
rootUser, it should only be used for management purposes.
Daily use of the database should be done by ordinary users. We will see it in a separate tutorial.
More database tutorials:
- MongoDB basic tutorial
- How is MongoDB different from SQL database
- Information system, data and information
- Data model
- Introduction to ER data model
- Relational model
- Relational algebra
- relational database
- What is a database? There is also a DBMS?
- Introduction to SQL
- How to install PostgreSQL on macOS
- Do you always need to provide a database for the application?
- How to install SQLite on macOS
- Introduction to PostgreSQL
- PostgreSQL user permissions
- How to list all users in PostgreSQL
- How to switch database using PostgreSQL
- How to list all databases using PostgreSQL
- How to use PostgreSQL to list the tables in the current database
- How to install MySQL on macOS
- Create user on MySQL
- PostgreSQL vs MySQL, comparison
- SQLite user permissions
- MySQL user permissions
- SQL, create table
- SQL, add data to the table
- SQL, how to use SELECT
- SQL, handle empty cells
- SQL, unique key and primary key
- SQL, how to update data
- SQL, how to update the table structure
- SQL, how to delete data and tables
- SQL connection
- SQL view
- How to insert multiple items in a MongoDB collection at once
- How to delete all items from MongoDB collection