centos7-mariadb安装
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了centos7-mariadb安装,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3869字,纯文字阅读大概需要6分钟。
内容图文
![centos7-mariadb安装](/upload/InfoBanner/zyjiaocheng/495/d42636e418d14f5a961d8027eba793e9.jpg)
原文:https://www.bbsmax.com/A/6pdDE6rLzw/
- 下载mariadb :https://downloads.mariadb.org/ 我选择mariadb-10.0.20-linux-x86_64.tar.gz这个版本
- 复制安装文件 /opt 目录下 并解压到当前目录 tar -zxf mariadb-10.0.20-linux-x86_64.tar.gz
- 把解压的文件名改为mariadb
- groupadd mysql
- useradd -g mysql mysql
- cd /opt/mariadb
- chown -R mysql:mysql /opt/mariadb/data
- 把mariadb/support-files下的my-medium.cnf复制到mariadb目录下,并改为my.cnf
- ./scripts/mysql_install_db --defaults-file=./my.cnf //初始化数据库 ,此步骤会报错,执行yum install libaio
- cp support-files/mysql.server /etc/rc.d/init.d/mysqld
- chmod +x /etc/rc.d/init.d/mysqld
- cp support-files/my-large.cnf /etc/my.cnf
- 修改 /etc/rc.d/init.d/mysqld basedir=/opt/mariadb datadir=/opt/mariadb/data
- service mysqld start
- 修改环境变量 添加mariadb的bin目录 编辑/etc/profile,添加export PATH=$PATH:/opt/mariadb/bin/
- 修改root用户密码 ./bin/mysqladmin -u root password ‘123456‘
- 登录mysql ./bin/mysql -u root -p
- 设置数据库权限:
- MySQL [(none)]> use mysql;
- MySQL [mysql]> update user set host=‘%‘ where user=‘root‘ and host=‘127.0.0.1‘;
- MySQL [mysql]> grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘ with grant option;
- MySQL [mysql]> flush privileges;
9步骤的日志如下
Installing MariaDB/MySQL system tables in ‘./data‘ ...
2017-11-27 16:43:13 139861016680192 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table ‘mysql.gtid_slave_pos‘ doesn‘t exist
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
‘./bin/mysqladmin‘ -u root password ‘new-password‘
‘./bin/mysqladmin‘ -u root -h xxxxxx(阿里云实例id) password ‘new-password‘
Alternatively you can run:
‘./bin/mysql_secure_installation‘
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd ‘.‘ ; ./bin/mysqld_safe --datadir=‘./data‘
You can test the MariaDB daemon with mysql-test-run.pl
cd ‘./mysql-test‘ ; perl mysql-test-run.pl
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB‘s strong and vibrant community:
https://mariadb.org/get-involved/
14步骤报错日志:
[root@iz2ze9hcysthc28l5tgqrpz init.d]# service mysqld start
Starting MySQL.171127 16:59:01 mysqld_safe Logging to ‘/opt/mariadb/data/(实例id).err‘.
171127 16:59:01 mysqld_safe Starting mysqld daemon with databases from /opt/mariadb/data
[FAILED]
[root@iz2ze9hcysthc28l5tgqrpz init.d]# tail -300f /opt/(实例id).err
171127 16:59:01 mysqld_safe Starting mysqld daemon with databases from /opt/mariadb/data
2017-11-27 16:59:02 140540362131264 [Note] /opt/mariadb/bin/mysqld (mysqld 10.2.7-MariaDB-log) starting as process 2611 ...
2017-11-27 16:59:02 140540362131264 [ERROR] mysqld: File ‘./mysql-bin.index‘ not found (Errcode: 13 "Permission denied")
2017-11-27 16:59:02 140540362131264 [ERROR] Aborting
14步解决方案
chgrp -R mysql /opt/mariadb/data && chown -R mysql /opt/mariadb/data
18:无法远程连接,原因是因为防火墙,开启指定服务:
# firewall-cmd --permanent --add-service=mysql
# firewall-cmd --reload
centos7-mariadb安装
标签:min report date star end form war bbs repo
本文系统来源:http://www.cnblogs.com/zhonghuahero/p/7904878.html
内容总结
以上是互联网集市为您收集整理的centos7-mariadb安装全部内容,希望文章能够帮你解决centos7-mariadb安装所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。