当前位置:网站首页>MySQL usage
MySQL usage
2022-07-26 04:19:00 【linchao100】
1、 Sign in mysql
sudo mysql -u root -p
Input password
2、 view the database
show databases
3、 Using a database
use xxx
4、 Create database
CREATE DATABSE mydatabase( Database name ) [character set utf8 ( Encoding mode )] ; # With utf8 Encoding set
Create database ( Easy to display Chinese ), Don't specify , The default setting is latin1 For coding
SHOW DATABASES; # Show current database
USE mydatabase; # Use the just created mydatabase database
CREATE TABLE users(username char (50) NULL,passwd char(50) NULL); # Create a table
5、 insert data
INSERT INTO users(username, passwd) VALUES('lilei','1234');
INSERT INTO users(username, passwd) VALUES(' Han Meimei ','1234');
6、 Configure remote access
Modify the configuration file
Configure remote access mysql:vim /etc/mysql/mysql.conf.d/mysqld.cnf
Comment out : bind-address = 127.0.0.1
vim Comment out the line change instruction under the editor , And save exit .
7、 Create a new user
Generally for safety , We don't use... Directly root user , Instead, choose to create a new user .
In the server , Input mysql -u root -p , go in mysql,
Then type the following command to create the user
GRANT ALL ON . to [email protected]‘ip’ IDENTIFIED BY ‘pwd’;
There's no mention of authority here ,
user It's the user name you want to create
ip Is the access address ,% On behalf of remote access ,localhost It's a local visit , It can also be specific to a certain ip Address , What we are going to use here is %
pwd It's the password you want to create
The user created above is a user with all permissions , It can be understood as second only to root user , It's an administrator .
After creation, you can refresh the permission table
FLUSH PRIVILEGES;
It's OK without refreshing , Because we can restart mysql.
sudo /etc/init.d/mysql restart
边栏推荐
- VM虚拟机 没有未桥接的主机网络适配器 无法还原默认配置
- Use of anonymous functions
- How to write the summary? (including 7 easily ignored precautions and a summary of common sentence patterns in 80% of review articles)
- 解决:RuntimeError: Expected object of scalar type Int but got scalar type Double
- 2022杭电多校 Bowcraft
- 2022 Hangzhou Electric Multi school bowcraft
- Acwing game 61 [End]
- This article takes you to graph transformers
- Pathmatchingresourcepatternresolver parsing configuration file resource file
- Recommendation | DBT skills training manual: baby, you are the reason why you live
猜你喜欢

MySQL的优化分析及效率执行

Wu Enda's machine learning after class exercises - logical regression

The era of smart clothes has come. Zhinar invites you to discuss swords in Yangcheng. Guangya Exhibition is waiting for you on August 4

2021 CIKM |GF-VAE: A Flow-based Variational Autoencoder for Molecule Generation

Mantium 如何在 Amazon SageMaker 上使用 DeepSpeed 实现低延迟 GPT-J 推理

零售连锁门店收银系统源码管理商品分类的功能逻辑分享

Support proxy direct connection to Oracle database, jumpserver fortress v2.24.0 release

dijango学习

How to transfer English documents to Chinese?

文献|关系研究能得出因果性结论吗
随机推荐
Credit card fraud detection based on machine learning
AcWing. 102 best cattle fence
Sweet butter
Implementation of distributed lock
Apisex's exploration in the field of API and microservices
荐书|《DBT技巧训练手册》:宝贝,你就是你活着的原因
Soft simulation rasterization renderer
[SVN] please execute the 'cleanup' command appears all the time. The solution is that there is no response after cleanup
香甜的黄油
What are the differences between vite and wenpack?
Use of rule engine drools
Constructing verb sources for relation extraction
Huawei executives talk about the 35 year old crisis. How can programmers overcome the worry of age?
当你尝试删除程序中所有烂代码时 | 每日趣闻
红星美凯龙高负债之下,盯上新能源了?
智装时代已来,智哪儿邀您一同羊城论剑,8月4日,光亚展恭候
1. Mx6u-alpha development board (GPIO interrupt experiment)
Share | 2022 big data white paper of digital security industry (PDF attached)
Web测试方法大全
How to choose the key words of the thesis?