Install MySQL locally (mac)

1. Download Mysql
address: Download address
Insert image description here
2. Local installation
1. Double-click the downloaded file to install.
Double-click
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
the installation is complete! !
2. Open "System Preferences" and find that there is a MySQL control button at the bottom.
Insert image description here
Click the MySQL control button at the bottom and find that MySQL data is already running:
Insert image description here
here you can start and stop the MySQL database, and you can also set whether the MySQL data is started at startup.
Insert image description here
3. Configuration
Open the terminal, enter the MySQL installation directory /usr/local/mysql, enter the bin directory, and execute the mysql -u root -p login statement: the
Insert image description here
system prompts the "-bash:mysql:command not found" error because the command is executed. The system will actively search for the command under the environment variable $PATH. If the command is not found, it will prompt that it does not exist. Because we did not configure MySQL after installing MySQL, the system cannot find the mysql command.

Edit the .bash_profile file, add the MYSQL_PATH environment variable, and add the bin directory to the PATH environment variable: After
Insert image description here
saving and exiting, execute the source .bash_profile command to make the changes take effect immediately. Continue to use the root user to log in to the MySQL data. The password is the password set during installation:
Insert image description here
execute the use mysql command to enter the database and perform related operations.
( Other reference articles )

3. Use MySQL Workbench to manage MySQL database.
Download address: workbench
Insert image description here
1. Local installation. Double-
click
Insert image description here
Insert image description here
. After installation, open Workbench:
Insert image description here
click "Local instance 3306" to connect to the database, enter the new password of the root user:
Insert image description here
click the "OK" button to connect, and enter MySQL after the connection is successful. Database management interface:
Insert image description here
At this point, the MySQL database can be visually managed using the MySQL Workbench tool.
2. Create a new database and authorize the user to
click the "Users and Privileges" button on the left menu, enter the new user's username (framework_user), connection address (% means from any address), password and confirm password, and click the "Apply" button :
Insert image description here
After the addition is successful, it is found that the user list has the user framework_user:
Insert image description here
Right-click in the blank space of the "SCHEMAS" area on the left and select "Create Schemas" in the pop-up menu: Enter the
Insert image description here
database name "framework" and select the encoding format "utf8" - default collation", click the "Apply" button to create a new database:
Insert image description here
the system generates a create data statement, click the "Apply" button:
Insert image description here
the database is created successfully, click the "Close" button:
Insert image description here
There is an additional "framework" database in the "Schemas" list on the left side of Mysql Workbench :
Insert image description here
Click "Users and Privileges" on the left side of Mysql Workbench, select the "framework_user" user in the "User Accounts" list, click the "Schemas Privileges" button: click the "
Insert image description here
Add Entry..." button, select the "framework" database, and click the "OK" button :
Insert image description here
Click the "Select "ALL"" button, select all permissions, and click the "Apply" button:
Insert image description here
There is additional authorization information in the permission information box:
Insert image description here
In summary, framework_user has the permission to perform all operations on the framework data.

Guess you like

Origin blog.csdn.net/bigge_L/article/details/118766906