MySQL/mariadb/centos安装:修订间差异
来自康健生活
| (未显示同一用户的1个中间版本) | |||
| 第47行: | 第47行: | ||
/etc/my.cnf | /etc/my.cnf | ||
{{hc|my.cnf|<syntaxhighlight lang=" | {{hc|my.cnf|<syntaxhighlight lang="mysql"> | ||
[mysqld] | [mysqld] | ||
init_connect='SET collation_connection = utf8_unicode_ci' | init_connect='SET collation_connection = utf8_unicode_ci' | ||
| 第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=" | |||
show variables like "%character%";show variables like "%collation%";</syntaxhighlight>|mysql>}} | show variables like "%character%";show variables like "%collation%";</syntaxhighlight>|mysql>}} | ||
|- | |||
| 创建用户命令 || {{shc|<syntaxhighlight lang="mysql"> | |||
create user username@localhost identified by 'password';</syntaxhighlight>|mysql>}} | |||
创建用户命令 | |- | ||
| 直接创建用户并授权的命令 || {{shc|<syntaxhighlight lang="mysql"> | |||
mysql>create user username@localhost identified by 'password'; | grant all on *.* to username@localhost indentified by 'password';</syntaxhighlight>|mysql>}} | ||
直接创建用户并授权的命令 | |- | ||
| 授予外网登陆权限 || {{shc|<syntaxhighlight lang="mysql"> | |||
mysql>grant all on *.* to username@localhost indentified by 'password'; | grant all privileges on *.* to username@'%' identified by 'password';</syntaxhighlight>|mysql>}} | ||
授予外网登陆权限 | |- | ||
| 授予权限并且可以授权 || {{shc|<syntaxhighlight lang="mysql"> | |||
mysql>grant all privileges on *.* to username@'%' identified by 'password'; | grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;</syntaxhighlight>|mysql>}} | ||
授予权限并且可以授权 | |} | ||
mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option; | |||