mariadb 安装
来源:互联网 发布:移动端js调用相册 编辑:程序博客网 时间:2024/06/01 16:11
yum 源准备
根据自己的系统和软件版本,自动生成yum配置
https://downloads.mariadb.org/mariadb/repositories/
如果是内网,需要将tar包下载下来,并加压,放入apache httpserver中
创建MariaDB.repo
[mariadb]name = MariaDBbaseurl = http://ip:port/mariadb/mariadb-10.2.6-rhel-6-x86_64-rpms/gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=0
yum install MariaDB-server
Running Transaction Installing : MariaDB-common-10.2.6-1.el6.x86_64 1/7 Installing : MariaDB-compat-10.2.6-1.el6.x86_64 2/7 Installing : MariaDB-client-10.2.6-1.el6.x86_64 3/7 Installing : boost-program-options-1.41.0-28.el6.x86_64 4/7 Installing : galera-25.3.20-1.rhel6.el6.x86_64 5/7 Installing : MariaDB-server-10.2.6-1.el6.x86_64 6/7 chown: cannot access `/var/lib/mysql': No such file or directoryPLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !To do so, start the server, then issue the following commands:'/usr/bin/mysqladmin' -u root password 'new-password''/usr/bin/mysqladmin' -u root -h cnsz033394 password 'new-password'Alternatively you can run:'/usr/bin/mysql_secure_installation'which will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the MariaDB Knowledgebase at http://mariadb.com/kb or theMySQL manual for more instructions.Please report any problems at http://mariadb.org/jiraThe latest information about MariaDB is available at http://mariadb.org/.You can find additional information about the MySQL part at:http://dev.mysql.comConsider joining MariaDB's strong and vibrant community:https://mariadb.org/get-involved/ Erasing : mysql-libs-5.1.71-1.el6.x86_64 7/7 rhel-base/productid | 1.6 kB 00:00 Verifying : galera-25.3.20-1.rhel6.el6.x86_64 1/7 Verifying : MariaDB-compat-10.2.6-1.el6.x86_64 2/7 Verifying : MariaDB-client-10.2.6-1.el6.x86_64 3/7 Verifying : MariaDB-common-10.2.6-1.el6.x86_64 4/7 Verifying : MariaDB-server-10.2.6-1.el6.x86_64 5/7 Verifying : boost-program-options-1.41.0-28.el6.x86_64 6/7 Verifying : mysql-libs-5.1.71-1.el6.x86_64 7/7 Installed: MariaDB-compat.x86_64 0:10.2.6-1.el6 MariaDB-server.x86_64 0:10.2.6-1.el6 Dependency Installed: MariaDB-client.x86_64 0:10.2.6-1.el6 MariaDB-common.x86_64 0:10.2.6-1.el6 boost-program-options.x86_64 0:1.41.0-28.el6 galera.x86_64 0:25.3.20-1.rhel6.el6 Replaced: mysql-libs.x86_64 0:5.1.71-1.el6 Complete!
更新数据库配置
启动服务器
service mysql start
更新服务器安全配置
mysql_secure_installation
更新配置文件
配置文件默认通过 /etc/my.cnf 来引用 /etc/my.cnf.d 下面的文件
enable_encryption.preset mysql-clients.cnf server.cnf
修改数据存放目录
mysql, MariaDB 的默认数据存放在 /var/lib/mysql/ 目录下,如果不想放到此处,或者是想要程序和数据分离,或者是磁盘原因,需要切换到其他路径,则可以通过修改 datadir系统变量来达成目的.
停止数据库
service mysql stop
创建目录,假设没有的话
mkdir /appcom/mariadb_data
拷贝默认数据库到新的位置 ,-a 命令是将文件属性一起拷贝,否则各种问题
cp -a /var/lib/mysql /appcom/mariadb_data
在文件的 mysqld 节下添加内容
vim /etc/my.cnf.d/server.cnf
[mysqld]datadir=/appcom/mariadb_data/mysql socket=/var/lib/mysql/mysql.sock#default-character-set=utf8 character_set_server=utf8 slow_query_log=on slow_query_log_file=/appcom/mariadb_data/slow_query_log.log long_query_time=2
其中,也只有 datadir 和 socket 比较重要; 而 default-character-set 是 mysql 自己认识的,而 mariadb5.5 就不认识,相当于变成了 character_set_server
创建慢查询日志文件
既然上面指定了慢查询日志文件,我后来看了下MariaDB的err日志,发现MariaDB不会自己创建该文件,所以我们需要自己创建,并修改相应的文件权限(比如 MySQL 采用 mysql用户,可能我们使用 root用户创建的文件,此时要求慢查询日志文件对mysql用户可读可写就行。)
touch /appcom/mariadb_data/slow_query_log.log
chmod 666 /appcom/mariadb_data/slow_query_log.log
然后重新启动MySQL.
数据库和用户管理
create database hadoop_monitor;
grant all on hadoop_monitor.* to hadoop@localhost identified by ‘xxx’;
grant all on hadoop_monitor.* to hadoop@’%’ identified by ‘xxx’;
- mariadb安装
- MariaDB安装
- MariaDB安装
- 安装MariaDB
- 安装 mariadb
- mariadb 安装
- MariaDB安装
- 安装MariaDB
- Mariadb安装
- 安装MariaDB
- mariaDB安装
- [MariaDB]Linux 快速安装MariaDB
- 【MariaDB】安装MariaDB,与MySQL并存
- ubuntu 12.04 安装 mariadb
- Windows下安装MariaDB
- mariadb-5.5安装笔记
- MariaDB数据库安装
- Centos上安装MariaDB
- java.util.BitSet的使用
- 执行apt-get命令提示没有该命令
- 软键盘弹起收回,执行的动作
- 字母出现频率统计用python实现
- gRPC golang开发指南
- mariadb 安装
- OpenCV学习记录(二):自己训练haar特征的adaboost分类器进行人脸识别
- 解决部分控件,自动获取焦点的情况
- 杂记
- Oracle修改用户密码
- 磁力悬浮
- Professional JS(3.4.7The Object Type&3.5Operators)
- 日期
- 《JAVA与模式》之策略模式