mysql install
Installing on an Operating System
There are plenty of similar tutorials and documents, and Windows and Linux have different installation methods, so they are not covered in detail here. The Docker-based installation is mainly introduced below.
Docker Installation
提示
- Before running the container, if there is no bridge network, create one first for inter-container communication:
docker network create -d bridge fastbee-bridge - The official MySQL image uses latin encoding by default, which does not support Chinese. Change it to utf8 encoding; the timezone and case sensitivity are also set.
- MYSQL_ROOT_PASSWORD is the password of the root account.
- Run the command to install MySQL
shell
docker run \
--name mysql \
--publish 3306:3306 \
--env TZ=Asia/Shanghai \
--env MYSQL_DATABASE="fastbee" \
--env MYSQL_ROOT_PASSWORD=fastbee \
--volume /var/data/mysql/mysql:/var/lib/mysql \
--network fastbee-bridge \
--restart unless-stopped \
--detach \
mysql:5.7 \
--character-set-server=utf8 \
--collation-server=utf8_unicode_ci \
--lower-case-table-names=1Enter the container by running:
docker exec -it mysql /bin/bashModify the encoding — copy and execute the following directly;
exitis used to leave the container
shell
tee /etc/mysql/conf.d/mysql.cnf <<-'EOF'
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
EOF
exit- Use a MySQL management tool (such as Navicat) to open the fastbee database and import the
springboot/sql/fastbee.sqlscript from the project.

