In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
If you can't understand the article I wrote, there may be no tutorials you can read on the Internet.
Although this article is aimed at version 8.0.x, methods such as MySQL configuration are common.
Environmental Information and scope of Application #
Environmental information
Environment / Software version macOSmacOS MojaveMySQLMySQL 8.0.17
Scope of application
Environment / software version macOSmacOS is probably all right, MySQL8.0.x
Step zero, clear the previous MySQL#
(unless you want to install multiple versions)
Open the terminal, enter the following ๐ code, and execute
Sudo rm / usr/local/mysql sudo rm-rf / usr/local/mysql* sudo rm-rf / Library/StartupItems/MySQLCOM sudo rm-rf / Library/PreferencePanes/My* edit / etc/hostconfig and remove the line MYSQLCOM=-YES- rm-rf ~ / Library/PreferencePanes/My* sudo rm-rf / Library/Recipts/mysql* sudo rm-rf / Library/Receipts/MySQL* sudo rm-rf / private/var/db/receipts/*mysql*
Step 1, download the installation package #
Go to the official download address: https://www.mysql.com/downloads/, then at the bottom of the page, click to enter the community version download interface (figure ๐ below)
Select MySQL Community Server (figure ๐ below)
Select the version. Version 8.0.17 is selected here, and the macOS version is selected according to the current system. For the convenience of installation, the DMG format file is directly selected (figure ๐ below)
MySQL installation #
Double-click mysql-8.0.17-macos10.14-x86_64.dmg to start the installation (figure ๐ below)
Click 'continue' (figure ๐ below)
If you need to change the installation location, you can modify it in this step (figure ๐ below). Click install according to the default configuration here.
If you choose the first option (using strong password encryption), you can only connect to the MySQL 8 version. It is recommended that you choose the second option (using traditional encryption) to be compatible with the 5.x version of MySQL (figure ๐ below), but even if you select the first option, you can modify it later (see step 2 of the MySQL management interface below)
If you choose according to the above picture, then you need to set a password of more than 8 digits mixed with numbers or letters or symbols (to be remembered) (figure ๐ below)
Installation succeeded (figure ๐ below)
MySQL management interface #
After successful installation, the MySQL icon appears at the bottom of the system preferences (figure ๐ below)
For an introduction to the management interface, click Start MySQL Server to start it. If you are afraid of trouble, you can set it to boot. Here, you need to focus on clicking Initialize Database to change the encryption mode (figure ๐ below)
Click the installation location above to jump to the installation location (figure ๐ below)
Click Configuration in the management interface to configure the file location (figure ๐ below). What you need to pay attention to is the location of Data Directory.
Configure MySQL#
When you open the terminal, the default shell is dash, and you can replace it with zsh with the following ๐ code (most of the previous commands remain the same)
Chsh-s / bin/zsh
If you want to switch back, use the following ๐ code to switch back to bash
Chsh-s / bin/bash
It should be noted that after the replacement, the terminal will not take effect until it is exited and opened.
Look at the shell that MacOS now uses, enter and execute the following line of ๐ code:
Echo $SHELL # if your output is / bin/zsh, refer to the zsh terminal operation mode # if your output is / bin/bash, refer to bash
End operation mode
If shell is changed to zsh
Open the terminal and enter and execute the following ๐ code:
Vim / .zshrc
If no changes are made, the default bash is used
Enter and execute the following ๐ code:
Vim / .bash_profile
Then go to the configuration interface of vim editing (figure ๐ below), type I, notice the lower left corner, and now enter INSERT input mode.
Then enter the following ๐ code to add the MySQL installation path to the environment variable.
Export PATH=$PATH:/usr/local/mysql/bin
At the same time, you can also add the following two lines of ๐ code to set shortcut instructions to turn the MySQL server on or off (figure ๐ below)
Alias mysqlstart='sudo / usr/local/mysql/support-files/mysql.server start' alias mysqlstop='sudo / usr/local/mysql/support-files/mysql.server stop'
You can also change the above mysqlstart and mysqlstop to the commands you are familiar with, corresponding to the opening and closing of the server, respectively.
After that, press esc to exit insert mode and enter: wq (have: Oh) (below figure ๐ pay attention to the lower left corner)
After executing the above figure, exit the vim editing interface, and then enter and run the following ๐ code to save the previous configuration (figure ๐ below)
Source / .zshrc
If no changes are made, the default bash is used
Enter and execute the following ๐ code:
Source / .bash_profile
Finally, you can enter and execute the following ๐ code to confirm that the addition is successful:
Echo $PATH
If the addition is successful, the sentence / usr/local/mysql/bin appears.
Start the MySQL service #
Method 1: according to the setting shortcut instruction method mentioned in configuring MySQL, you can type mysqlstart directly in the terminal to start.
Method 2: start the MySQL service as described in the MySQL management interface above (figure ๐ below)
Method 3: alternatively, enter and run the following ๐ code on the terminal: (the login password of macOS will be required)
Sudo / usr/local/mysql/support-files/mysql.server start
You can also open the MySQL server
Prompt information
Starting MySQL
.logging to'/ usr/local/mysql/data/Kit-away.local.err'.
SUCCESS!
After that, enter and run the following ๐ code: (you will be asked to enter the password that you set more than 8 digits when you installed MySQL)
Mysql-uroot-p
Then the MySQL client is started smoothly.
You can try executing the following ๐ code:
Show databases
If the following ๐ is displayed, it means that it was run successfully as an administrator
+-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sys | +-+ 4 rows in set (0.01sec)
Download link:
Https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.17-macos10.14-x86_64.dmg
Summary
The above is the illustration of the MySQL 8.0.17 installation and simple configuration tutorial under macOS introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
ยฉ 2024 shulou.com SLNews company. All rights reserved.