1. Download Mysql
address: Download address
2. Local installation
1. Double-click the downloaded file to install.
Double-click
the installation is complete! !
2. Open "System Preferences" and find that there is a MySQL control button at the bottom.
Click the MySQL control button at the bottom and find that MySQL data is already running:
here you can start and stop the MySQL database, and you can also set whether the MySQL data is started at startup.
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
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
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:
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
1. Local installation. Double-
click
. After installation, open Workbench:
click "Local instance 3306" to connect to the database, enter the new password of the root user:
click the "OK" button to connect, and enter MySQL after the connection is successful. Database management interface:
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 :
After the addition is successful, it is found that the user list has the user framework_user:
Right-click in the blank space of the "SCHEMAS" area on the left and select "Create Schemas" in the pop-up menu: Enter the
database name "framework" and select the encoding format "utf8" - default collation", click the "Apply" button to create a new database:
the system generates a create data statement, click the "Apply" button:
the database is created successfully, click the "Close" button:
There is an additional "framework" database in the "Schemas" list on the left side of Mysql Workbench :
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 "
Add Entry..." button, select the "framework" database, and click the "OK" button :
Click the "Select "ALL"" button, select all permissions, and click the "Apply" button:
There is additional authorization information in the permission information box:
In summary, framework_user has the permission to perform all operations on the framework data.