查看“︁MySQL/mariadb/centos安装”︁的源代码
来自康健生活
←
MySQL/mariadb/centos安装
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 安装 == 搜索 MariaDB 现有的包 <syntaxhighlight lang="bash"> rpm -qa | grep mariadb</syntaxhighlight> 删除 MariaDB 现有的包 <syntaxhighlight lang="bash"> rpm -e --nodeps mariadb-*</syntaxhighlight> 或者 <syntaxhighlight lang="bash"> yum remove</syntaxhighlight> 创建MariaDB.repo <syntaxhighlight lang="bash"> vi /etc/yum.repos.d/MariaDB.repo</syntaxhighlight> <pre> # MariaDB 10.2.4 CentOS repository list - created 2017-05-05 16:13 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.2.4/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1</pre> <syntaxhighlight lang="bash"> yum -y install mariadb MariaDB-server MariaDB-client</syntaxhighlight> <syntaxhighlight lang="bash"> systemctl start mariadb systemctl enable mariadb</syntaxhighlight> {| class="wikitable" |- ! 标题文字 !! 标题文字 |- | systemctl start mariadb || 启动服务 |- | systemctl enable mariadb || 设置开机启动 |- | systemctl restart mariadb || 重新启动 |- | systemctl stop mariadb.service || 停止MariaDB |- | 示例 || 示例 |} 进行MariaDB的相关简单配置 <syntaxhighlight lang="bash"> mysql_secure_installation</syntaxhighlight> === 配置 MariaDB 的字符集 === /etc/my.cnf {{hc|my.cnf|<syntaxhighlight lang="mysql"> [mysqld] init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake</syntaxhighlight>}} /etc/my.cnf.d/client.cnf {{hc|client.cnf|<syntaxhighlight lang="mysql"> [client] default-character-set=utf8</syntaxhighlight>}} /etc/my.cnf.d/mysql-clients.cnf {{hc|mysql-clients.cnf|<syntaxhighlight lang="mysql"> [mysql] default-character-set=utf8</syntaxhighlight>}} {| class="wikitable" |- | || {{shc|<syntaxhighlight lang="bash"> systemctl restart mariadb</syntaxhighlight>}} |- | MariaDB 查看字符集 || {{shc|<syntaxhighlight lang="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"> grant all on *.* to username@localhost indentified by 'password';</syntaxhighlight>|mysql>}} |- | 授予外网登陆权限 || {{shc|<syntaxhighlight lang="mysql"> grant all privileges on *.* to username@'%' identified by 'password';</syntaxhighlight>|mysql>}} |- | 授予权限并且可以授权 || {{shc|<syntaxhighlight lang="mysql"> grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;</syntaxhighlight>|mysql>}} |}
此页面嵌入的页面:
模板:Hc
(
查看源代码
)
模板:Hc/style.css
(
查看源代码
)
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
返回
MySQL/mariadb/centos安装
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。