当前位置:网站首页>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];
边栏推荐
- Uber 前安全主管面临欺诈指控,曾隐瞒数据泄露事件
- SSD改进CFENet
- GD32F4xx 以太網芯片(enc28j60)驅動移植
- Five heart charity matchmaker team
- Go deep into RC, RS, daemonset and statefulset (VII)
- 长安链GO语言智能合约编写与编译
- UE4 display 3D editable points in Viewport
- Reading notes on how to connect the network - Web server request and response (V)
- Open3d hidden point removal
- In the future of Business Intelligence BI, how do you view the ai+bi model?
猜你喜欢

Wechat applet latest canvas2d handwritten signature

LFFD:一种用于边缘检测的轻量化快速人脸检测器

Redo after JS rotation view (longer full version, can be run)

Mysql配置主从数据库

UE4 动画重定向

1.4 机器学习方法之回归问题

两阶段目标检测原理详细版

Detecting and counting tiny faces

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

Western Polytechnic University, one of the "seven national defense schools", was attacked by overseas networks
随机推荐
Simplicity studio does not recognize the new JLINK V9 solution
Detailed version of two-stage target detection principle
Simplicity Studio无法识别新买的JLink v9解决方法
Twinmotion 初学者教程
Gd32f4xx Ethernet chip (ENC28J60) driver migration
Which securities company is good for opening a mobile account? Is it safe to open an account online?
Wechat applet wx Navigateback returns the parameters carried on the previous page
HB5470民用飞机机舱内部非金属材料燃烧测试
Wechat applet opens file stream
Recursive RBAC menu level display infinite classification
Find the most repeated element in the string
In the era of data processing, data quality construction is the way for enterprises to survive
1.4 regression of machine learning methods
UE4 去掉材质中Mask透明白边
深卷积神经网络时代的目标检测研究进展
手机开户一般哪个证券公司好?究竟网上开户是否安全么?
UE4 installs the datasmith plug-in in version 4.20-23
Go deep into RC, RS, daemonset and statefulset (VII)
UE4 材质UV纹理不随模型缩放拉伸
Chapter 12 signals (II) - examples of producers and consumers