how to install MySQL on macOS
how to install MySQL on macOS
MySQL Community Server 8.0.21
# version
$ mysqladmin --version
# 8.0.21
$ mysql --version
# mysql Ver 8.0.21 for osx10.15 on x86_64 (Homebrew)
$ mysqladmin --version
# mysqladmin Ver 8.0.21 for osx10.15 on x86_64 (Homebrew)
# start MySQL server once
$ mysql.server start
# stop
$ mysql.server stop
# no password, connect
$ mysql -uroot
background service
# start MySQL server with background service
$ brew services start mysql
# stop
$ brew services stop mysql
MySQL commands
# 查看所有数据库
mysql> show databases;
# 创建数据库
mysql> create database test;
# 选择数据库
mysql> use test;
# 查看所有数据表
mysql> show tables;
# 创建数据表, 推荐使用大写的的关键字
mysql> create table `demo_table`(
`table_id` INT UNSIGNED AUTO_INCREMENT,
`table_title` VARCHAR(100) NOT NULL,
`table_author` VARCHAR(40) NOT NULL,
`created_date` DATE,
PRIMARY KEY (`table_id`)
);
# OR,
mysql> create table `demo_table`(`table_id` int unsigned auto_increment, `table_title` varchar(100) not null, `table_author` varchar(40) not null, `created_date` date, primary key (`table_id`));
# 操作数据表(插入数据)
mysql> insert into demo_table (table_title, table_author, created_date) VALUES ("MySQL Tutorials", "xgqfrms", now());
mysql> insert into demo_table (table_title, table_author, created_date) VALUES ("SQL Tutorials", "webgeeker", now());
# 操作数据表(查询)
mysql> select * from demo_table;
mysql> select table_title, table_author from demo_table;
mysql> select table_id, table_title, table_author, created_date from demo_table;
# \G, 格式化输出,美化
mysql> select * from demo_table\G;
# 操作数据表(修改数据)
mysql> update demo_table set table_title="DB Tutorials" where table_id=1;
# 操作数据表(删除数据)
mysql> delete from demo_table where table_id=1;
# 删除数据表
mysql> drop table demo_table;
# 删除数据库
mysql> drop database test;
MySQL 语法
# 创建数据表的 SQL通用语法
# CREATE TABLE table_name (column_name column_type, ..., column_name column_type, );
CREATE TABLE IF NOT EXISTS `demo_table`(
`table_id` INT UNSIGNED AUTO_INCREMENT,
`table_title` VARCHAR(100) NOT NULL,
`table_author` VARCHAR(40) NOT NULL,
`created_date` DATE,
PRIMARY KEY ( `table_id` )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
# INSERT INTO 语句插入数据表中数据的通用语法
INSERT INTO table_name ( field1, field2,...fieldN ) VALUES ( value1, value2,...valueN );
# 如果数据是字符型,必须使用单引号或者双引号,如:"value"
INSERT INTO demo_table
(table_title, table_author, created_date)
VALUES
("MySQL Tutorials", "xgqfrms", NOW());
# SELECT 语句查询数据表中数据的通用语法
SELECT column_name,column_name
FROM table_name
[WHERE Clause]
[LIMIT N][ OFFSET M];
# UPDATE 语句修改数据表中数据的通用语法
UPDATE table_name SET field1=new-value1, field2=new-value2
[WHERE Clause];
# DELETE 语句删除数据表中数据的通用语法
DELETE FROM table_name [WHERE Clause];
.dmg
install
mysql-8.0.21-macos10.15-x86_64.dmg
https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.21-macos10.15-x86_64.dmg
manually install bug
$ sudo chmod +x ./mysqladmin
brew
# mysql
$ brew install mysql
# daemon mode(background service)
$ brew services start mysql
$ brew services stop mysql
# avoid daemon mode(once)
$ mysql.server start
$ mysql.server stop
$ mysql -u root -p
https://flaviocopes.com/mysql-how-to-install/
https://stackoverflow.com/questions/4359131/brew-install-mysql-on-macos
MySQL 5
mysql-5.7
https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation-pkg.html
MySQL 8
mysql-8.0.21
mysql-8.0.21-macos10.15-x86_64.tar.gz
https://dev.mysql.com/downloads/mysql/
refs
.pkg
go1.14.7.darwin-amd64.pkg
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
how to install MySQL on macOS的更多相关文章
- Install MySQL on Mac by Homebrew
1. 安装mysql brew update brew install mysql 2. 启动mysql mysql.server start 3. 登录mysql mysql -uroot -p ...
- yum install mysql
rpm -qa|grep -i mysqlmysql-libs-5.1.52-1.1.alios6.1.x86_64mysql-5.1.52-1.1.alios6.1.x86_64mysql-deve ...
- 在OSX狮子(Lion)上安装MYSQL(Install MySQL on Mac OSX)
这篇文章简述了在Mac OSX狮子(Lion)上安装MySQL Community Server最新版本v10.6.7的过程. MySQL是最流行的开源数据库管理系统.首先,从MySQL的下载页面上下 ...
- ubuntu install mysql server method
recently try to install mysql in my computer so that I can practise some sql statement on seve ...
- macbook install mysql
安装Homebrew,详细步骤参见Homebrew官网. brew doctor确认brew在正常工作. brew update更新包. brew install mysql 安装mysql.log如 ...
- install mysql from source and troubleshooting example
I tried to install MySQL 5.7 from source file and upgrading previous MySQL version to the lastest 5. ...
- 执行了‘“npm install mysql"
http是核心模块,封装到安装包里面了,如果在你项目的当前目录下<code>npm install mysql<code>的话就会在你当前目录下的node_modules文件夹 ...
- Install MySQL 5.7 on Fedora 25/24, CentOS/RHEL 7.3/6.8/5.11
MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user ...
- Install MySql on CentOS
Installing & Configuring MySQL Server This Howto will show you how to install MySQL 5.x, start t ...
随机推荐
- Serverless对研发效能的变革和创新 云托管和Serverless应用差异
https://mp.weixin.qq.com/s/J4RXtKanh3IMr4fY7t0nyQ Serverless对研发效能的变革和创新 杨皓然(不瞋) 阿里巴巴中间件 2020-10-23
- celery 动态配置定时任务
How to dynamically add or remove tasks to celerybeat? · Issue #3493 · celery/celery https://github.c ...
- fastjson的deserializer的主要优化算法 漏洞
JSON最佳实践 | kimmking's blog http://kimmking.github.io/2017/06/06/json-best-practice/ Fastjson内幕 Java综 ...
- LOJ10092半连通子图
Description 一个有向图G=(V,E)称为半连通的(Semi-Connected),如果满足:?u,v∈V,满足u→v或v→u,即对于图中任意两点u,v,存在一条u到v的有向路径或者从v到u ...
- Core3.1 微信v3 JSAPI支付 退款
1.前言 上一篇写了<Core3.1 微信v3 JSAPI支付>,这个属于v3的接口规则,现在研究了下退款的接口我写的时候它属于v2接口规则文档.但凡微信支付文档里面写清楚点我也不会在这里 ...
- 分布式缓存 — MongoDB
--- 数据库管理系统 数据库管理系统主要分为俩大类:RDBMS.NOSQL.在个人电脑.大型计算机和主机上应用最广泛的数据库管理系统是关系型DBMS.NoSQL是对不同于传统的关系数据库的数据库管理 ...
- H5 的直播协议和视频监控方案
H5 的直播协议和视频监控方案 一.流媒体主要实现方式 二.流媒体技术 2.1 流媒体 2.2 直播 2.3 流协议 2.3.1 HLS 协议 2.3.2 RTMP 协议 2.3.3 RTSP 协议 ...
- C++的转换手段并与explicit关键词配合使用
前言 C中我们会进行各种类型的强制转化,而在C中我们经常可以看到这种转换 memset(OTA_FLAG_ADDRESS,(uint8_t*)&OTA_Flag,sizeof(OTA_Flag ...
- hdu 6822 Paperfolding 规律+排列组合+逆元
题意: 给你一片纸,你可以对它进行四种操作,分别是向上.向下.向左.向右对折.把对折之后的纸片横向剪开,再纵向剪开(十字架剪开) 问你你能剪出来的纸片的期望个数 题解(参考:https://blog. ...
- Codeforces Round #652 (Div. 2) C. RationalLee 贪心
题意: t组输入,你有n个数,还有k个朋友,每一个朋友需要wi个数.意思就是你要给第i个朋友分配wi个数,输入保证w1+w2+...+wk=n 一个朋友的兴奋值是你分配给他的数中最大值加上最小值的和( ...