首页 > 数据库技术 > 详细

MySQL安装

时间:2021-08-24 09:51:15      阅读:30      评论:0      收藏:0      [点我收藏+]

安装MySQL

一、下载MySQLyum源

wegt httpd://repo.mysql.com/mysql-communtiy-release-e17-5.noarch.rpm

创建MySQLyum源

rpm-ivh mysql-community-release-e17-5.noarch.rpm

安装MySQL服务端

yum -y install mysql-server

设置开机启动

systemctl enable mysql && systemctl start mysqld

二、密码要求:

密码要至少包含:

一个大写字母

一个小写字母

一个数字

一个特殊字符

密码长度不小于8

user分为host为localhost与%的用户:

User@% 允许从所有的ip访问. User@localhost 只允许从localhost访问。

三、SQL语句有三种类型:

DDL:Data Defination Language,数据定义语言 (结构)

DML:Data ManipulationLanguage,数据操纵语言 (数据)

DCL:Data Control Language,数据控制语言

SQL语句类型 对应操作
DDL create:创建
  drop:删除
  alter: 修改
DML insert:向表中插入数据
  delete:删除表格中的数据
  update:更新表格中的数据
  select:查询表格中的数据
DCL grant:授权
  revoke: 移除授权

四、MySQL客服端命令

MySQL客服端命令官方文档

mysql> help

List of all MySQL commands:
Note that all text commands must be first on line and end with ‘;‘
?         (\?) Synonym for `help‘.
clear     (\c) Clear the current input statement.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit      (\e) Edit command with $EDITOR.
ego       (\G) Send command to mysql server, display result vertically.
exit      (\q) Exit mysql. Same as quit.
go        (\g) Send command to mysql server.
help      (\h) Display this help.
nopager   (\n) Disable pager, print to stdout.
notee     (\t) Don‘t write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (\p) Print current command.
prompt    (\R) Change your mysql prompt.
quit      (\q) Quit mysql.
rehash    (\#) Rebuild completion hash.
source    (\.) Execute an SQL script file. Takes a file name as an argument.
status    (\s) Get status information from the server.
system    (\!) Execute a system shell command.
tee       (\T) Set outfile [to_outfile]. Append everything into given
               outfile.
use       (\u) Use another database. Takes database name as argument.
charset   (\C) Switch to another charset. Might be needed for processing
               binlog with multi-byte charsets.
warnings  (\W) Show warnings after every statement.
nowarning (\w) Don‘t show warnings after every statement.
resetconnection(\x) Clean session context.
query_attributes(\) Sets string parameters (name1 value1 name2 value2 ...)
for the next query to pick up.

For server side help, type ‘help contents‘

常用:

clear, \c

清空当前的输入,实例:

mysql> select wrong
    -> \c
mysql>

connect [db_name [host_name]], \r [db_name [host_name]]

重新连接指定主机下的数据库

delimiter str, \d str

指定SQL语句分界符号,默认为:

prompt [str], \R [str]

修改提示符为指定的字符串

resetconnection, \x

HELP命令的使用

mysql> help contents
You asked for help about help category: "Contents"
For more information, type ‘help <item>‘, where <item> is one of the
following categories:
   Account Management
   Administration
   Data Definition
   Data Manipulation
   Data Types
   Functions
   Functions and Modifiers for Use with GROUP BY
   Geographic Features
   Language Structure
   Plugins
   Storage Engines
   Stored Routines
   Table Maintenance
   Transactions
   Triggers

可以使用%与_进行命令的匹配:

mysql> HELP rep%
Many help items for your request exist.
To make a more specific request, please type ‘help <item>‘,
where <item> is one of the following
topics:
   REPAIR TABLE
   REPEAT FUNCTION
   REPEAT LOOP
   REPLACE
   REPLACE FUNCTION

MySQL安装

原文:https://www.cnblogs.com/Aimmi/p/15178284.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!