MySQL/mariadb/centos安装:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
 
第67行: 第67行:
default-character-set=utf8</syntaxhighlight>}}
default-character-set=utf8</syntaxhighlight>}}


{{shc|<syntaxhighlight lang="bash">
{| class="wikitable"
|-
|  || {{shc|<syntaxhighlight lang="bash">
systemctl restart mariadb</syntaxhighlight>}}
systemctl restart mariadb</syntaxhighlight>}}
 
|-
MariaDB 查看字符集
| MariaDB 查看字符集 || {{shc|<syntaxhighlight lang="mysql">
 
{{shc|<syntaxhighlight lang="mysql">
show variables like "%character%";show variables like "%collation%";</syntaxhighlight>|mysql>}}
show variables like "%character%";show variables like "%collation%";</syntaxhighlight>|mysql>}}
 
|-
创建用户命令
| 创建用户命令 || {{shc|<syntaxhighlight lang="mysql">
 
{{shc|<syntaxhighlight lang="mysql">
create user username@localhost identified by 'password';</syntaxhighlight>|mysql>}}
create user username@localhost identified by 'password';</syntaxhighlight>|mysql>}}
 
|-
直接创建用户并授权的命令
| 直接创建用户并授权的命令 || {{shc|<syntaxhighlight lang="mysql">
 
{{shc|<syntaxhighlight lang="mysql">
grant all on *.* to username@localhost indentified by 'password';</syntaxhighlight>|mysql>}}
grant all on *.* to username@localhost indentified by 'password';</syntaxhighlight>|mysql>}}
 
|-
授予外网登陆权限  
| 授予外网登陆权限 || {{shc|<syntaxhighlight lang="mysql">
 
{{shc|<syntaxhighlight lang="mysql">
grant all privileges on *.* to username@'%' identified by 'password';</syntaxhighlight>|mysql>}}
grant all privileges on *.* to username@'%' identified by 'password';</syntaxhighlight>|mysql>}}
 
|-
授予权限并且可以授权
| 授予权限并且可以授权 || {{shc|<syntaxhighlight lang="mysql">
{{shc|<syntaxhighlight lang="mysql">
grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;</syntaxhighlight>|mysql>}}
grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;</syntaxhighlight>|mysql>}}
|}