Failed to start mysqld.service: Unit not found问题解决方案

2023-05-16

1.首先安装mariadb-server
yum install -y mariadb-server
2.启动服务
systemctl start mariadb.service
3.添加到开机启动
systemctl enable mariadb.service
4.安全设置,修改数据库管理员密码
[root@js opt]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):

什么都不用输入,直接回车。

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures 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 can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will 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 MariaDB
installation should now be secure.

Thanks for using MariaDB!
(py3) [root@js opt]# mysql -uroot -paisino
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use mysql;
ERROR 1049 (42000): Unknown database 'mysql;'
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> select  User,authentication_string,Host from user;
    -> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that                                                                                         corresponds to your MariaDB server version for the right syntax to use near 'GRA                                                                                        NT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456'' at line 2
MariaDB [mysql]> select  User,authentication_string,Host from user; GRANT ALL P                                                                                        RIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'aisino';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that                                                                                         corresponds to your MariaDB server version for the right syntax to use near 'GRA                                                                                        NT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'aisino'' at line 1
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'aisino                                                                                        ';
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]>

root开启远程访问权限

use mysql;
select  User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Failed to start mysqld.service: Unit not found问题解决方案 的相关文章

随机推荐

  • [C/C++后端开发学习] 11 实现一个简单的HTTP服务器

    文章目录 实现GET方法约定GET时URI的格式状态机与websocket协议兼容实现几个辅助函数GET请求一个html页面 一张图片或一个PDF文件 实现POST方法实现一个简单的服务框架POST请求报文处理的代码块POST响应报文处理的
  • C++ Primer Plus习题及答案-第六章

    习题选自 xff1a C 43 43 Primer Plus 第六版 内容仅供参考 xff0c 如有错误 xff0c 欢迎指正 1 简单文件输入 输出 xff08 写入到文本文件中 xff09 对于文件输入 xff0c C 43 43 使用
  • 航模电池-LiPo锂聚合物电池(未完待续)

    一 外形 1 一般有几个电芯 xff0c 就是几 S xff0c 比如三个电芯就是3S 2 从电池上 xff0c 会引出两组导线 xff0c 一组细的 xff0c 一组粗的 细的一组 xff0c 由一根红线和若干根黑线组成 xff0c 最前
  • visual studio 编译C++程序,加快编译速度

    网上很多有关于选择预编译选项出现 xff0c fatal error C1083 无法打开预编译头文件 pch No such file or directory xff0c 这样的错误 xff0c 好多人会选择直接不使用预编译选项 如果工
  • C++中标准名称空间出错(cout,cin,endl是一个未知标识符)

    相信有很多小伙伴刚刚学习C 43 43 都有出现cout cin endl为未知标识符 原因是 xff1a lt iostream gt 头文件没有namespace std库 解决方法有3种 xff0c 如下 方法1 xff1a 加 us
  • C++源文件编译过程

    对于C 43 43 源文件 xff0c 从文本到可执行文件一般需要四个过程 xff1a 预处理阶段 编译阶段 汇编阶段 链接阶段 预处理阶段 xff1a 对源代码文件中文件包含关系 xff08 头文件 xff09 预编译语句 xff08 宏
  • 最短路径算法之AStar算法(一) AStar算法的证明

    本文并不试图对A Star算法进行一个入门式的讲解 xff0c 因为光是那个讲解就有可能会占据很长的篇幅 xff0c 而且网上已经有讲解的文章 xff0c 讲的肯定比我好 所以 xff0c 本文是面向已经对A Star算法有了一定了解的人
  • 最短路径算法之AStar算法(三) 《A* Pathfinding for Beginners》一文中的两个问题

    现在 xff0c 看看网上流传的很广的一篇文章 A Pathfinding for Beginners xff0c 经典的A STar算法的入门文章 xff0c 也是我前面推荐的阅读文章 个人认为 xff0c 这篇入门文章的算法不能找出最短
  • 最短路径算法之AStar算法(四) 可变H函数

    前面的文章已经讨论过 xff0c 当H函数可变时 xff0c 前面给出的AStar算法伪过程存在问题 xff0c 并且通过实际的例子证明了问题的存在 现在 xff0c 让我们具体分析一下问题究竟出现在什么地方 我们回顾一下AStar算法的证
  • 物流定位系统项目qt代码

    头文件 ifndef USER INTERFACE H define USER INTERFACE H include lt QWidget gt include lt QLabel gt include lt QMouseEvent gt
  • python中运用urllib.request简单抓取网页数据

    urllib request 1 抓取百度首页 1 from urllib import request 2 3 url 4 根据url获取数据 xff0c 下载数据到本地 5 正则orXpath处理数据 6 数据转储 7 8 url 61
  • STM32基础知识之串口通信协议

    串口通信协议 串口的硬件缓存允许收发一次大小都是一字节 xff08 比如0xAA xff09 xff0c 而由串口多次发送的数据的多个字节组成了一帧数据 xff0c 这帧数据被缓存在了软件定义的一个数组中 一帧数据的典型格式如下 第一次发送
  • DataX实现mysql全量数据同步到hdfs

    目录 一 xff1a 什么是DataX 1 1 DataX的概述 xff1a 1 2 DataX的设计 xff1a 1 3 支持的数据库 1 4 框架设计 xff1a 1 5 运行原理 xff1a 1 6 与 Sqoop 的对比 二 xff
  • 16KM数传电台

    1 http www dlmytech com products detail productId 61 85 html
  • C语言中怎么将int类型的数据转换为字符串(STM32程序)

    61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61
  • 字节序(byte order)和位序(bit order)

    一 网络字节序与主机字节序 在Linux网络编程中 xff0c 经常碰到网络字节序与主机字节序的相互转换 说到网络字节序与主机字节序需要清晰了解以下几个概念 1 字节序 字节序 xff0c 顾名思义 xff0c 指字节 Byte 在内存中存
  • 虚拟机和主机相互ping不通方法总结

    一 虚拟机和主机相互ping不通的解决方法 1 主要检查几个方面 xff1a 1 xff09 检查虚拟网卡有没有被禁用 2 xff09 检查虚拟机与物理机是否在一个VMNet中 3 xff09 检查虚拟机的IP地址与物理机对应的VMNet是
  • grafana告警规则设置

    Linux 内存告警配置 问题 xff1a Template variables are not supported in alert queries 解决办法 xff1a 单独配置个告警的视图 xff0c 用正则匹配出所有的主机 或者 每
  • 无法启动此程序因为计算机中丢失vcruntime140_1.dll

    安装mysql8的时候发现需要VCRUNTIME140 1 dll文件 该文件在C Windows System32下面 解决方法 推荐去微软官网下载最新的2015 2019vc 43 43 支持包 https support micros
  • Failed to start mysqld.service: Unit not found问题解决方案

    1 首先安装mariadb server yum install y mariadb server 2 启动服务 systemctl start mariadb service 3 添加到开机启动 systemctl enable mari