Feb 09, 2020 Undoubtedly, installing a brew is a good choice. For what brew is, how to install it, it is recommended to check it on the brew official website, with the address: brew official website. After installation, it is very convenient to install other software. Implementation: brew install mysql. # this will wipe all mysql data # if you want to keep data from your old mysql installation, do not do this sudo rm -rf /usr/local/var/mysql/ brew remove mysql brew cleanup brew install mysql. I was then able to mysql.server start without an issue. If you want MySQL to start automatically on boot, run brew services start mysql. For installing DBD::mysql you need to have the libssl header files and the mysql client libs. The easiest way to install these is using Homebrew (Once you have Homebrew set up, you can simply install the dependencies using. Brew install openssl mysql-connector-c. Then you can install DBD::mysql using your cpan client.
On macOS, you can install MySQL easily using Homebrew.
The above command should take a while, then print something like this:
Brew services start email protected You can then check so the mysql service is running using: brew services list Now try to create symlinks for the mysql package: brew link -force email protected You might need to add the location to mysql to your path, to find the location of the package: brew list email protected. Use the brew install command to install an application. For example, to install mysql, run: brew install mysql. The command has a lot of options available,.
You can now start the MySQL server by running:
Now we need to secure the MySQL server. By default the server comes without a root password, so we need to make sure it’s protected.
The procedure can take a while, but it gives a lot of power to make sure you get the best defaults out of the box:
Since we used
brew services start mysql to start MySQL, your Mac will re-start it at reboot. You can run:
to stop this from happening, and also to immediately stop MySQL.
You can also avoid this daemon mode (that’s what we call programs that always run in the background and restart when the computer is restarted) by running:
This will start MySQL and will keep it running until the computer is shut down, or until you run:
and it will not re-start it at reboot.
It’s up to you to decide which one you prefer.
Now you can connect to the server using the command:
You will need to type the
root user password after you run this command, and once you are done you should see this screen:
A great GUI (graphical) software we can use to interact with a SQLite database is TablePlus.
It comes with a free trial that’s perfect for our usage, because it’s not time-based but rather it limits the amount of concurrent connections you can make to the database.
Download it from https://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, and enter “root” and the password you set previously:
Connect, and you should be connected to MySQL!
Note that we are connected using the
root user, which should only be used for administration purposes.
Day to day use of a database should be done using a normal user. We’ll see it in a separate tutorial.