0%

MySQL 安装

MySQL 安装

MacOS

  1. 下载
    download from https://dev.mysql.com/downloads/mysql/, select macOS 10.14 (x86, 64-bit), DMG Archive(.dmg file)

顺路会看到一个叫 workbench 的,可视化工具,就像看 excel 看数据库,which is recommended.

  1. 安装
    clike next all the way.

set the PATH

1
2
3
vim ~/.bash_profile
# 增加以下这行
PATH=$PATH:/usr/local/mysql/bin

Windows

同样在https://dev.mysql.com/downloads/mysql/下载,略。

Ubuntu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# download the configuration
wget https://dev.mysql.com/get/mysql-apt-config_0.8.14-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.14-1_all.deb
# default is fine, select OK and return

sudo apt update
sudo apt-get install mysql-server
# set password(spa2020)
# use strong password encryption

sudo mysql_secure_installation
# enter password
# n (不换root密码)
# Remove anonymous users? : y(删除匿名用户)
# Disallow root login remotely?: n(是否禁止 root 远程登录)
# Remove test database and access to it? : y(删除测试数据库)
# Reload privilege tables now? : y(立即重新加载特权表)

mysql -V # check version
# mysql Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)

WSL

参见此文

macOS 和 Windows 下可以装个数据库 GUI app

  • MySQL Workbench (free & recommend)
    如同处理 excel,不用学 mysql 命令也能操作数据库啦