How To Mysql Server For Mac

  



MySql is a very popular relational sql database server software. It is widely used in huge of websites as the database server. This article will tell you how to install MySql database server and GUI client tool on MacOS to make MySql database management easily.

How To Mysql Server For Mac 10 11

1. Install MySql Database Server On Mac.

Mac
  1. Download MySql Server community version for MacOS.
  2. Click the downloaded dmg file to open the MySql server installer package.
  3. Click Next button in the wizard dialog until go to the Change Install Location… dialog, then click Install button to install it.
  4. After installation, it will display Configure MySQL Server dialog, input root user’s password. And click Finish button to complete MySql server installation.
  5. Now MySql server has been installed successfully.

How To Download Mysql Server For Mac

The MySQL server is installed on the Mac, but it does not load by default. Start MySQL by clicking Start using the MySQL Preference Pane, which was installed during the default installation. You can configure MySQL to automatically start when you turn on your computer using the MySQL Preference Pane.

2. Start, Stop, Configure MySql Server.

  1. Open MacOS System Preferences.
  2. Click MySQL button to open MySQL configuration dialog. Then you can start, stop and configure MySQL server in it.
  • In this post we will learn how to How To Install MySQL on Mac OS X. The same procedure can be used for installing MySQL on Mac OS X. How to add MySQL to $PAT.
  • To start MySQL on Mac, you can use the command line. The commands you use depend on which version of MySQL you have: either before 5.7 or 5.7 and newer. Version 5.7 came out in October 2015, so if you’ve downloaded it anytime in the last few years it’s most likely after 5.7.
  • Jun 05, 2020 We need to run the MySQL Server in order to connect to it and perform database operations. To run it in your Mac use this command.

3. Manage MySQL Database With MySQL Workbench.

  1. Download MySQL Workbench community version.
  2. Click the downloaded dmg file to install it.
  3. Open MySQL workbench application.
  4. Connect to the local MySQL database server.
  5. Click the Create a new schema in the connected server button to create a database.
  6. Input mysql database name and select database character set and collation. Click Apply button to create the database.
  7. Right click the Tables item under dev2qa database then click Create Table… menu item to create table.
  8. Input table name at top text box. Then click table row to add one column, input column name, select datatype and other column options(Primary Key, Not Null, Unique, Auto Increment, Binary etc).
  9. Right click user_account table, click Select Rows – Limit 1000 menu item to open edit table data dialog in right panel to insert data into the table.

4. Create MySQL User and Assign Privileges To The User.

Mysql For Macbook

  1. Click Users and Privileges menu item in left MySQL workbench panel.
  2. Click Add Account button at the bottom of right panel.
  3. Input user name and password in the new panel.
  4. Click Administrative Roles tab to select related roles and assign them to the newly created MySQL user.
  5. Click Schema Privileges tab to assign MySQL database (schema) privileges to the user by click Add Entry… button. You can select all database, or special database either by matching string pattern or exactly string match.
  6. Then select desired Object Rights, DDL Rights or Other Rights checkboxes at bottom, then click Apply button to apply the selected privileges to the created user.

5. Create Example User Account Table.

In our mysql jdbc examples, we always use a table user_account, so we should create this table use MySQL workbench. Below is the table DDL sql code, you can also run it to create this table.

Mysql Server Installation

To execute below DDL code, just click Create a new SQL tab for executing queries button ( ) at mysql workbench tool bar top left corner to open a sql command execute window, and then copy below code into it. Then click execute button(the first lightning icon ) at the top tool bar of the sql window to execute the code.

The package is located inside a disk image (.dmg) file that you first need to mount by double-clicking its icon in the Finder. It should then mount the image and display its contents.

Before proceeding with the installation, be sure to stop all running MySQL server instances by using either the MySQL Manager Application (on macOS Server), the preference pane, or mysqladmin shutdown on the command line.

To install MySQL using the package installer:

How To Mysql Server For Mac
  1. Download the disk image (.dmg) file (the community version is available here) that contains the MySQL package installer. Double-click the file to mount the disk image and see its contents.

    Figure 2.1 MySQL Package Installer: DMG Contents


  2. Double-click the MySQL installer package from the disk. It is named according to the version of MySQL you have downloaded. For example, for MySQL server 5.7.34 it might be named mysql-5.7.34-osx-10.13-x86_64.pkg.

  3. The initial wizard introduction screen references the MySQL server version to install. Click to begin the installation.

    Figure 2.2 MySQL Package Installer Wizard: Introduction


  4. The MySQL community edition shows a copy of the relevant GNU General Public License. Click and then to continue.

  5. From the Installation Type page you can either click to execute the installation wizard using all defaults, click to alter which components to install (MySQL server, Preference Pane, Launchd Support -- all enabled by default).

    Although the option is visible, the installation location cannot be changed.

    Figure 2.3 MySQL Package Installer Wizard: Installation Type


    Figure 2.4 MySQL Package Installer Wizard: Customize


  6. Click to begin the installation process.

  7. After a successful installation, the installer displays a window with your temporary root password. This cannot be recovered so you must save this password for the initial login to MySQL. For example:

    Figure 2.5 MySQL Package Installer Wizard: Temporary Root Password


    MySQL expires this temporary root password after the initial login and requires you to create a new password.

  8. Summary is the final step and references a successful and complete MySQL Server installation. the wizard.

    Figure 2.6 MySQL Package Installer Wizard: Summary


MySQL server is now installed, but it is not loaded (or started) by default. Use either launchctl from the command line, or start MySQL by clicking 'Start' using the MySQL preference pane. For additional information, see Chapter 3, Installing a MySQL Launch Daemon, and Chapter 4, Installing and Using the MySQL Preference Pane. Use the MySQL Preference Pane or launchd to configure MySQL to automatically start at bootup.

When installing using the package installer, the files are installed into a directory within /usr/local matching the name of the installation version and platform. For example, the installer file mysql-5.7.34-osx10.13-x86_64.dmg installs MySQL into /usr/local/mysql-5.7.34-osx10.13-x86_64/ . The following table shows the layout of the installation directory.

Table 2.1 MySQL Installation Layout on macOS

DirectoryContents of Directory
binmysqld server, client and utility programs
dataLog files, databases
docsHelper documents, like the Release Notes and build information
includeInclude (header) files
libLibraries
manUnix manual pages
mysql-testMySQL test suite
shareMiscellaneous support files, including error messages, sample configuration files, SQL for database installation
support-filesScripts and sample configuration files
/tmp/mysql.sockLocation of the MySQL Unix socket

During the package installer process, a symbolic link from /usr/local/mysql to the version/platform specific directory created during installation is created automatically.