当前位置:网站首页>Building MySQL environment under Ubuntu & getting to know SQL
Building MySQL environment under Ubuntu & getting to know SQL
2022-04-23 13:45:00 【Du Xiaorui】
sudo apt-get install mysql-server
apt-get isntall mysql-client
sudo apt-get install libmysqlclient-dev
Use after installation sudo netstat -tap | grep mysql Check it out. mysql Running state , If in the listen state , No problem
Next, we will mysql Initial configuration ,sudo mysql_secure_installation
Just follow the prompts and choose one by one , Now we have configured the password , Check it out. mysql state , systemctl status mysql.service
:
The display is normal as described above .
Next, configure remote access .
Open profile sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
take bind-address = 127.0.0.1 Comment out .
Then log in Mysql, Switch such as mysql database :
Use delete from user where user=’’; Delete anonymous users :
Add users that allow remote access or allow remote access to existing users . After deleting anonymous users , to root Granted on any host (%) All permissions to access any database grant all privileges on . to ‘root’@’%’ identified by ‘123456’ with grant option;
If you need to specify an access host , You can put % Replace with the IP Or host name . in addition , This method will be in the database mysql Table of user in , Add a record . If you don't want to add records , Just want to put an existing user ( for example root) Modified to allow remote host access , You can use the following SQL To complete :
update user set host=’%’ where user=‘root’ and host=‘localhost’;
Finally exit and restart mysql:
sudo service mysql restart
complete !
Reference material :
https://www.cnblogs.com/wangwust/p/9765843.html
First time to know SQL
SQL sentence
sql Statements can be divided into the following three categories :
DDL(Data Definition Language, Data definition language ) It is used to create or delete the database used to store data and the tables in the database .DDL Contains the following instructions :
- CREATE : Create objects such as databases and tables
- DROP : Delete objects such as databases and tables
- ALTER : Modify the structure of objects such as databases and tables
DML(Data Manipulation Language, Data manipulation language ) Used to query or change records in a table .DML Contains the following instructions :
- SELECT : Query data in table
- INSERT : Insert new data into the table
- UPDATE : Update the data in the table
- DELETE : Delete data from table
DCL(Data Control Language, Data control language ) Used to confirm or cancel changes to data in a database . besides , You can also be right about RDBMS Whether or not the user has permission to operate the objects in the database ( Database table, etc ) To set .DCL Contains the following instructions :
- COMMIT : Confirm changes to the data in the database
- ROLLBACK : Cancel changes to the data in the database
- GRANT : Give the user permission to operate
- REVOKE : Cancel the user's operation permission
Table update
Add columns ALTER TABLE sentence :
ALTER TABLE < Table name > ADD COLUMN < Definition of columns >;
Delete column ALTER TABLE sentence :
ALTER TABLE < Table name > DROP COLUMN < Name >;
Clear table contents :
TRUNCATE TABLE TABLE_NAME;
Update of data :
UPDATE < Table name >
SET < Name > = < expression > [, < Name 2>=< expression 2>...];
WHERE < Conditions >; -- Optional , It's very important .
ORDER BY Clause ; -- Optional
LIMIT Clause ; -- Optional
版权声明
本文为[Du Xiaorui]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230556584848.html
边栏推荐
- Ora-600 encountered in Oracle environment [qkacon: fjswrwo]
- QT调用外部程序
- Logstash数据处理服务的输入插件Input常见类型以及基本使用
- Longitude and latitude position of provincial capitals in China
- Ai21 labs | standing on the shoulders of giant frozen language models
- GDB的使用
- Oracle and MySQL batch query all table names and table name comments under users
- Move blog to CSDN
- Oracle database combines the query result sets of multiple columns into one row
- 联想拯救者Y9000X 2020
猜你喜欢
./gradlew: Permission denied
MySQL [acid + isolation level + redo log + undo log]
Oracle job scheduled task usage details
QT calling external program
Lenovo Savior y9000x 2020
Campus takeout system - "nongzhibang" wechat native cloud development applet
Small case of web login (including verification code login)
Set Jianyun x Feishu Shennuo to help the enterprise operation Department realize office automation
[point cloud series] summary of papers related to implicit expression of point cloud
[point cloud series] unsupervised multi task feature learning on point clouds
随机推荐
Detailed explanation of constraints of Oracle table
Dolphin scheduler configuring dataX pit records
Analysis of cluster component gpnp failed to start successfully in RAC environment
Error 403 in most cases, you or one of your dependencies are requesting
Oracle clear SQL cache
Oracle index status query and index reconstruction
Analysis of unused index columns caused by implicit conversion of timestamp
Personal learning related
Plato farm, a top-level metauniverse game, has made frequent positive moves recently
Usereducer basic usage
./gradlew: Permission denied
MySQL [acid + isolation level + redo log + undo log]
交叉碳市场和 Web3 以实现再生变革
TERSUS笔记员工信息516-Mysql查询(2个字段的时间段唯一性判断)
Detailed explanation and usage of with function in SQL
Dolphin scheduler scheduling spark task stepping record
Logstash数据处理服务的输入插件Input常见类型以及基本使用
浅谈js正则之test方法bug篇
Why do you need to learn container technology to engage in cloud native development
Technologie zéro copie