当前位置:网站首页>Basic operations of MAC MySQL database
Basic operations of MAC MySQL database
2022-06-29 09:33:00 【Novice little white petal God】
1、 start-up 、 restart 、 stop it 、 see MySQL state
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
sudo /usr/local/mysql/support-files/mysql.server status
2、 Reset password
Not for a long time , It's common to forget your password ... The password needs to be reset .
mysql -u root -p
3. Access to database
/usr/local/MySQL/bin/mysql -u root -p
4. Query the database
show databases;
Two 、 Connect to the remote database and enter the command line :
Suppose the remote host's IP by :ip Address , The user is called root, The password for 123456
1、 Open the terminal , Enter the following command :
mysql -h ip Address -u root -p 123456
2、 Input password :
Interface prompts for password :
Enter password:
If the database is used for the first time , The default password is blank , Enter directly mysql Command line ;
If password is set , Then enter the password , enter , You can enter mysql Command line .
3、 ... and 、 Exit command :exit, Press enter again to exit mysql Command line .
Four :
1、 Create a name for NickYang database create database NickYang character set utf8;
2、 Modify database code :alter database NickYang character set utf8;
3、 Check whether the database is created successfully :show databases;
4、 Access to database :use NickYang;
5、 Create a table and assign a primary key to it :create table yang(id int primary key);
6、 See if the table was created successfully :show tables;
7、 View table structure :desc Table name ;
8、 Add fields :alter table Table name add Field name data type [ Location ];
alter table yang add name varchar(255) after id;
9、 Delete field :alter table Table name drop Field name ;
alter table yang drop name;
10、 The new data :insert into Table name ( Field name ) values( value )
insert into yang(id,name) values(1,'name');
11、 Delete data :delete from Table name [where Conditions ];
delete from yang [where id = 1]
12、 Modifying data :update Table name set Field = value [where Conditions ]
update yang set name = 'yang' where id = 1;
13、 Find data :select * from Table name [where Conditions ];
select * from yang [where id = 1];
边栏推荐
- UE4 编译单个文件(VS与编辑器分别启动)
- Which securities company is good for opening a mobile account? Is it safe to open an account online?
- After aikuai is installed or reset, the PC or mobile terminal cannot obtain IP
- YOLO Nano:一种高度紧凑的只看一次的卷积神经网络用于目标检测
- pytorch总结学习系列-广播机制
- pytoch总结—TENSOR 和NUMPY相互转换
- LeetCode刷题——泰波那契数列
- Pytorch Summary - sensor on GPU
- Mongodb persistence
- programing language
猜你喜欢

pytorch总结学习系列-操作

Wechat applet custom multi selector

Written test question "arrange version numbers from large to small"

SSD改進CFENet

pytorch总结学习系列-数据操作

Data visualization: the four quadrants of data visualization teach you to correctly apply icons

UE4 编译单个文件(VS与编辑器分别启动)

超融合架构和传统架构有什么区别?

Laravel 8 enables the order table to be divided by month level

train_ on_ Batch save the image of the loss function change
随机推荐
【技术开发】酒精测试仪解决方案开发设计
【数据集】|标注的bbox影响 Can we trust bounding box annotations for object detection
Self cultivation (XXI) servlet life cycle, service method source code analysis, thread safety issues
Wechat applet wx Navigateback returns the parameters carried on the previous page
商业智能BI的未来,如何看待AI+BI这种模式?
UE4 动画重定向
Mac mysql数据库基本操作
Data visualization: the four quadrants of data visualization teach you to correctly apply icons
两阶段目标检测原理详细版
UE4 在viewport视口中显示3D可编辑点
五心公益红红娘团队
UE4 插件报错 Cannot open include file: ‘ModuleManager.h‘解决
pytoch总结—TENSOR 和NUMPY相互转换
超融合架构和传统架构有什么区别?
Gd32f4xx Ethernet Chip (ENC28J60) Drive transplantation
Detecting and counting tiny faces
数据治理:元数据管理(第二篇)
SSD改进CFENet
长安链GO语言智能合约环境搭建及使用
Wechat applet sub components transfer values to the page (communication between parent and child components) with source code