当前位置: 首页 > wzjs >正文

网站建设及网络营销百度关键词推广

网站建设及网络营销,百度关键词推广,网站备案负责人幕布照,嘉禾手机网站建设系统环境 操作系统:CentOS 7.9 已安装旧版MariaDB:mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1 计划安装MariaDB 10.11版本。 步骤 一.如有需要,备份数据库数据。 略 二.卸载旧版MariaDB。 1.停止M…

系统环境

操作系统:CentOS 7.9

已安装旧版MariaDB:mysql  Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1

计划安装MariaDB 10.11版本。

步骤

一.如有需要,备份数据库数据。

二.卸载旧版MariaDB。

1.停止MariaDB服务。

sudo systemctl stop mariadb

sudo systemctl disable mariadb

2.卸载MariaDB。

执行卸载:

sudo yum remove mariadb-server mariadb-client mariadb-common

查看是否卸载干净:

rpm -qa | grep -i mariadb

显示还有两个残留:

mariadb-5.5.68-1.el7.x86_64

mariadb-libs-5.5.68-1.el7.x86_64

继续卸载:

sudo yum remove mariadb-5.5.68-1.el7.x86_64 mariadb-libs-5.5.68-1.el7.x86_64

再次查询是否卸载干净:

rpm -qa | grep -i mariadb

确认卸载干净,移除旧版MariaDB数据文件和配置文件(请根据实际情况调整):

sudo rm -rf /var/lib/mysql/

sudo rm -rf /etc/my.cnf*

sudo rm -rf /etc/mysql/

三.安装新版MariaDB。

1.创建MariaDB仓库文件。

CentOS系统软件源默认仅包含古老的MariaDB,安装新版本的MariaDB需要创加纳MariaDB仓库。

sudo vi /etc/yum.repos.d/MariaDB.repo

添加以下内容(具体软件版本和系统版本路径可直接浏览Index of /yum/,根据实际情况调整):

[mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/10.11.11/centos7-amd64gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=1

清理 YUM 缓存:

sudo yum clean all

更新 YUM 缓存:

sudo yum makecache

2.安装MariaDB服务器和客户端。

sudo yum install MariaDB-server MariaDB-client

检查MariaDB版本:

mysql –version

mysql  Ver 15.1 Distrib 10.11.9-MariaDB, for Linux (x86_64) using readline 5.1

3.修改数据库配置。

vi /etc/my.cnf

将配置修改如下:

[mysqld]# 数据存储目录# datadir = /mnt/data/mysqldatadatadir = /home/mysqldata# 套接字文件路径socket = /var/lib/mariadb/mariadb.sock# 监听地址和端口bind-address = 0.0.0.0port = 3316# 字符集character-set-server = utf8mb4collation-server = utf8mb4_unicode_ci# 日志文件log_error = /var/log/mariadb/mariadb.logslow_query_log = 1slow_query_log_file = /var/log/mariadb/slow_query.loglong_query_time = 2# 二进制日志log_bin = /var/log/mariadb-bin/mariadb-bin.logexpire_logs_days = 7max_binlog_size = 100M# 临时表大小tmp_table_size = 64Mmax_heap_table_size = 64M# 连接设置max_connections = 5000max_user_connections = 1000wait_timeout = 600interactive_timeout = 600# 查询缓存query_cache_type = 0query_cache_size = 0# 表定义缓存table_open_cache = 4000table_definition_cache = 2000# InnoDB 配置innodb_buffer_pool_size = 4Ginnodb_buffer_pool_instances = 8innodb_log_file_size = 256Minnodb_log_buffer_size = 16Minnodb_flush_log_at_trx_commit = 1innodb_file_per_table = 1innodb_flush_method = O_DIRECTinnodb_thread_concurrency = 8# MyISAM 配置key_buffer_size = 64M# 其他配置skip_name_resolve = 1back_log = 150thread_cache_size = 100open_files_limit = 65535symbolic-links = 0local-infile = 0old_passwords = 0[client]default-character-set = utf8mb4connect_timeout = 30

由于自定义了数据文件存放位置,需要手动创建数据库的数据文件夹,并授权。

mkdir /home/mysqldata

chown -R mysql:mysql /home/mysqldata

由于自定义了数据库日志文件存放位置,需要手动创建数据库日志文件夹,并授权。

mkdir /var/log/mariadb /var/log/mariadb-bin

chown -R mysql:mysql mariadb

chown -R mysql:mysql mariadb-bin

由于自定义了socks文件存放位置,需要手动创建socks文件夹。

mkdir /var/lib/mariadb

4.启动数据库。

sudo systemctl start mariadb

会发现无法启动,查看错误:

sudo systemctl status mariadb

有报错:

[Warning] Can't create test file '/home/mysqldata/VM-32-51-centos.lower-test' (Errcode: 2 "No such file or directory")

看报错推测应该是MariaDB没有权限在数据文件夹下创建文件,但是我们前面已经对数据文件夹做了授权。

这里就涉及到新版MariaDB的一个脑残设定,默认不允许在用户目录(/root,/home)下存放数据文件,旧版MariaDB无此问题。

修改mariadb.service配置,关闭Home保护:

vi /usr/lib/systemd/system/mariadb.service

# Prevent accessing /home, /root and /run/user

ProtectHome=true

把true改为false

重新加载服务配置并重启服务:

sudo systemctl daemon-reload

systemctl start mariadb

发现systemctl start mariadb命令卡住不动。

继续查看报错:

sudo systemctl status mariadb

Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded

可以发现错误提示有一些数据表找不到。

这里就涉及到新版MariaDB的又一个脑残设定,当数据文件夹为空时,不会自动创建默认数据库和数据表,旧版MariaDB无此问题。

手动将安装MariaDB时默认数据库文件夹下面的文件拷贝至自定义的数据库文件夹:

cp -R /var/lib/mysql/* /home/mysqldata

chown -R mysql:mysql /home/mysqldata

或者重新执行mysql_install_db来装载默认数据库。

/usr/bin/mysql_install_db

再次启动服务:

systemctl start mariadb

终于可以启动服务。

5.配置数据库账户。

以socks方式连接数据库:

mysql -u root

发现无法连接。

以TCP方式连接数据库:

mysql -u root -P9916

发现仍然无法连接。

这里就涉及到新版MariaDB的又一个脑残设定,安装MariaDB后,需要执行一次安全初始化才能正常使用,如果安装后未运行初始化操作,可能会导致权限配置不完整。

运行安全脚本

mysql_secure_installation

提示命令找不到,/usr/bin目录下无此文件,全局搜索:

sudo find / -name mysql_secure_installation

文件并不存在,莫非文件改名了,试试mariadb_secure_installation,文件依然不存在。

这里就涉及到新版MariaDB的又一个脑残设定,mysql_secure_installation被改名为mariadb-secure-installation,不但修改了mysql字样,下划线也被修改为中划线。

执行之:

mariadb-secure-installation

In order to log into MariaDB to secure it, we'll need the current

password for the root user. If you've just installed MariaDB, and

haven't set the root password yet, you should just press enter here.

报错:

ERROR 2002 (HY000): Can't connect to local server through socket '/var/lib/mysql/mysql.sock' (2)

看报错可知,mariadb-secure-installation找不到sock文件,这里显示的sock文件是默认的sock文件路径,而非我们自定义的sock文件路径。

这就涉及到了mariadb-secure-installation的脑残设定,其sock路径是写死的,说明我们必须在修改MariaDB配置(修改sock路径)之前,就执行这个工具。鉴于我们已经提前修改了MariaDB配置,现在只能回头重新修改配置文件,把sock路径指向默认路径。

vi /etc/my.cnf

socket = /var/lib/mariadb/mariadb.sock

socket = /var/lib/mysql/mysql.sock

重新启动服务:

systemctl restart mariadb

重新执行初始化工具:

mariadb-secure-installation

Enter current password for root (enter for none):OK, successfully used password, moving on...Setting the root password or using the unix_socket ensures that nobodycan log into the MariaDB root user without the proper authorisation.You already have your root account protected, so you can safely answer 'n'.Switch to unix_socket authentication [Y/n] n... skipping.You already have your root account protected, so you can safely answer 'n'.Change the root password? [Y/n] YNew password:Re-enter new password:Password updated successfully!Reloading privilege tables..... Success!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] Y... Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] n... skipping.By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] n... skipping.Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] Y... Success!Cleaning up...All done!  If you've completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB!

执行完毕,使用sock方式连接数据库:

mysql -u root

连接成功,接下来可以配置数据库用户。

四.安装数据库备份工具。

Percona XtraBackup 是一个广泛使用的开源工具,专为 MySQL 和 MariaDB 数据库的物理备份而设计。然而,Percona XtraBackup 的某些版本可能与 MariaDB 的最新版本不完全兼容。为了更好地支持 MariaDB,MariaDB 社区开发了一个 XtraBackup 的分支,称为 MariaDB Backup,或者mariabackup。

安装之:

sudo yum install MariaDB-backup

http://www.dtcms.com/wzjs/105789.html

相关文章:

  • 腾讯分分彩做号网站seo是啥软件
  • 怎么做单向网站链接新公司怎么做网络推广
  • 电子商务网站开发是什么搜索量最大的关键词
  • 网站域名如何使用方法谷歌浏览器网页版入口在哪里
  • 广州乐地网站建设百度导航最新版本免费下载
  • 青岛公司做网站短视频入口seo
  • 信息平台建设方案阿亮seo技术
  • 设备租赁网站建设免费创建网站的平台
  • 水泥网站营销方案怎么做房地产网站模板
  • 自学移动端网站开发阿拉善盟seo
  • wordpress建站站长之家如何开发微信小程序
  • b2c网站对比爱站网关键词挖掘机
  • 积分兑换商城网站建设整站优化
  • 网站和域名域名注册信息查询
  • 山西省住房与城乡建设部网站seo网站推广经理
  • 关于政府网站建设的研究报告如何自己创建一个网站
  • 建设网站需要的材料优化关键词排名工具
  • 凡科网站的排名做不上去找培训机构的网站
  • 怎么做福彩网站软文广告素材
  • 成立网站要什么手续武汉刚刚突然宣布
  • 交友系统网站建设学生个人网页制作教程
  • 企业网站建设457网络技术推广服务
  • WordPress与dz用户恭喜站长工具seo词语排名
  • 网站做超链接薪资多少一个月北京做网站的公司有哪些
  • wordpress班级模板个人博客seo
  • 精通网站建设需要学什么如何免费找精准客户
  • 网站备案归哪里管天津seo推广
  • 广州哪里有网站开发怎样创建网页
  • 一般的信息网站用什么做seo问答
  • 北京网络网站建设价格推广引流图片