Configuring MySQL and Squel Pro on Mac

Configuring MySQL and Squel Pro on Mac

In response to the popularity of nodejs, we have recently used it to implement some server-side functions. For the database, we chose MySQL, which is suitable for both young and old. There will definitely be related application needs in the future. This article records how to install and configure MySQL and its management tool Squel Pro on Mac.

Why choose MYSQL:

There are many databases, why did I choose MySQL?

Relational Database or NoSQL
NoSQL has become very popular in recent years, and the best one among them, mongoDB, is particularly convenient and easy to use. It is probably not possible to discuss the details of the advantages and disadvantages of the two in one article. Here is a summary:
Projects suitable for SQL development:
The need for logically related discrete data can be defined in advance. Data consistency is essential. Standard, mature technologies with good developer experience and technical support are suitable for projects developed using NoSQL:
Unrelated, uncertain, and evolving data requirements Simpler or looser projects that can start programming quickly Speed ​​and scalability are critical Because our requirements are relatively clear, the relationships are relatively fixed, and the business volume is not large, the speed requirement is not high. On the contrary, the logic requirements are more stringent, so the traditional relational database is chosen.
Once it is decided to use a relational database, this problem is easier to solve, and simply following the trend and using MySQL seems to be the choice of most people. I personally summarize the reasons as follows:
Open source and free.
Mainstream, fast, and adequate performance.
There are many users and the community is active.
There are many supporting tools, which are simple and easy to use.

Install MySQL

1. Homebrew

You can choose to download and install it from the official website, but the command line is much more convenient after all. If you don't have homebrew, please open Terminal and use the following command to install it.

# Install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Verify that the installation is correct brew doctor

Install MySQL

brew install mysql

At this point, notice the prompt as follows, so start the service first, and then run the relevant commands:

We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation

Start MySQL Service

mysql.server start

Follow the prompts for mysql_secure_installation and set your username and password

mysql_secure_installation

Here you can follow the prompts step by step to set up, mainly including selecting the password strength, setting the password, confirming the password, whether to delete the passwordless user, whether to allow remote root login, and deleting the built-in test database.

Log in to test it

mysql -u root -p

MySQL Basic Commands

Although as FE, we finally chose the graphical management tool Squel Pro, but some basic commands still need to be mastered. There are still many application scenarios, for example, just want to do a quick check, or on someone else's computer, or when logging into the database remotely.

1. Basic commands

# Check which databases are available show databases;
# Check which database is currently being used select database();
# Select database use [database-name];
# Display the tables in the database
show tables;
# Create a database CREATE DATABASE [new-database-name];

Author: Scrap the Pillar Link: http://www.jianshu.com/p/2fab19d96eb8
Source: The copyright of Jianshu belongs to the author. For commercial reproduction, please contact the author for authorization. For non-commercial reproduction, please indicate the source.

2. Create a new user.

# Create user nodejs for localhost and set the password to nodejs
create user 'nodejs'@'localhost' identified by 'nodejs';
# Synchronize user permission information from the data table to the memory (this command can avoid restarting the MySQL service)
FLUSH PRIVILEGES;

Author: Scrap the Pillar Link: http://www.jianshu.com/p/2fab19d96eb8
Source: The copyright of Jianshu belongs to the author. For commercial reproduction, please contact the author for authorization. For non-commercial reproduction, please indicate the source.

3. Grant permissions.

Next, we create a database named nodejs for the current application and grant all its permissions to user nodejs.

CREATE DATABASE nodejs; 
GRANT ALL PRIVILEGES ON nodejs.* TO 'nodejs'@'%' IDENTIFIED BY 'nodejs';

Sequel Pro

Sequel Pro

After logging in, the software interface is as shown above. You can simply see the following functions:

Select the database in the upper left corner to manage the database

TABLES on the left column can manage data tables

The main area in the middle can manage the data in the data table.

In the upper right corner, click Users to manage users.

Console in the upper right corner allows you to easily run MySQL commands.

Install

Download the installation package from the official website and run it.

Log in

The interface is as follows. Enter Host , Username , and Password to log in. It is recommended to use the newly created nodejs user to log in and manage the nodejs database. Except for creating new users and granting permissions to new users, it is not recommended to use the root user for security reasons.

use

After logging in, click the upper right corner, you can see information such as selecting a database, creating a new database, etc., and then you can start viewing and managing the database. Since the graphical interface of the tool itself focuses on ease of use, I will not go into details here.

You may also be interested in:
  • Solution to forgetting the MYSQL database password under MAC
  • Download MySQL 5.7 and detailed installation diagram for MySql on Mac
  • Detailed graphic and text instructions for installing MySQL 5.7.20 on Mac OS
  • Solution to forget password when installing MySQL on Linux/Mac
  • Detailed steps to configure Apache + PHP + MySQL operating environment in Mac OS X
  • What to do if you forget the initial password when installing MySQL on Mac
  • How to modify the forgotten password when installing MySQL on Mac
  • Detailed steps to install mysql5.7.18 on Mac
  • MySQL installation and configuration tutorial for Mac
  • Detailed installation and configuration of MySql on Mac
  • Tutorial on compiling and installing MySQL 5.7.17 from source code on Mac
  • Solution to forgetting mysql password in MAC

<<:  Play with the connect function with timeout in Linux

>>:  Example explanation of alarm function in Linux

Recommend

How to use Portainer to build a visual interface for Docker

Portainer Introduction Portainer is a graphical m...

How to delete garbled or special character files in Linux

Due to encoding reasons, garbled characters will ...

Use of js optional chaining operator

Preface The optional chaining operator (?.) allow...

Perfect solution for vertical centering of form elements

Copy code The code is as follows: <!DOCTYPE ht...

Should I use UTF-8 or GB2312 encoding when building a website?

Often when we open foreign websites, garbled char...

Integration practice of Vue+Element background management framework

Table of contents Vue+ElementUI background manage...

Briefly understand the MYSQL database optimization stage

introduction Have you ever encountered a situatio...

jQuery plugin to achieve image comparison

This article example shares the specific code of ...

Writing tab effects with JS

This article example shares the specific code for...

Brief analysis of MySQL union and union all

In the database, both UNION and UNION ALL keyword...

Detailed tutorial on deploying Apollo custom environment with docker-compose

Table of contents What is the Apollo Configuratio...

How to implement scheduled automatic backup of MySQL under CentOS7

The happiest thing that happens in a production e...

Create a screen recording function with JS

OBS studio is cool, but JavaScript is cooler. Now...

Best Practices for Implementing Simple Jira Projects with React+TS

A set of projects for training react+ts Although ...

Summary of MySql import and export methods using mysqldump

Export database data: First open cmd and enter th...