mysql 重启 及编码问题

时间:2019-10-23
本文章向大家介绍mysql 重启 及编码问题,主要包括mysql 重启 及编码问题使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Failed to start mysql.service Unit not found.

执行完yum安装命令后发现竟然无法启动错误提示如下

[root@localhost ~]# systemctl start mysql.service

Failed to start mysql.service: Unit mysql.service not found.

查了半天资料,终于了解到MariaDB代替了mysql数据库

因此用上述命令启动不起来,正确的方法如下

# yum install mariadb -y //如果已安装可以省略

# systemctl start mariadb.service //启动服务

# systemctl enable mariadb.service //开机启动服务

# mysql -u root -p //登录mysql
————————————————
版权声明:本文为CSDN博主「佐手烈焰魂」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_38286347/article/details/85060407

Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 

1、去zabbix数据库主机查看数据库字符集。

show variables like '%char%';
1

可以看到 character_set_database和character_set_server的字符集都不是utf8的所以需要进行设置。
2、修改数据库配置文件(默认在/etc/my.cnf),增加如下配置:

[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8

重启数据库
3、登录后再次执行show variables like '%char%';结果都是utf8了,如下:


4、重新导入zabbix数据模型。
————————————————
版权声明:本文为CSDN博主「宫凯宁」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44723434/article/details/89145881

-bash-4.2# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service

Failed to restart mysqld.service: Unit not found

并不存在 mysqld 的服务,

-bash-4.2# 
-bash-4.2# chkconfig -list
-list: unknown option
-bash-4.2# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use ‘systemctl list-unit-files‘.
      To see services enabled on particular target use
      ‘systemctl list-dependencies [target]‘.

aegis           0:off   1:off   2:on    3:on    4:on    5:on    6:off
agentwatch      0:off   1:off   2:on    3:on    4:on    5:on    6:off
iprdump         0:off   1:off   2:on    3:on    4:on    5:on    6:off
iprinit         0:off   1:off   2:on    3:on    4:on    5:on    6:off
iprupdate       0:off   1:off   2:on    3:on    4:on    5:on    6:off
jexec           0:off   1:on    2:on    3:on    4:on    5:on    6:off
mysql.server    0:off   1:off   2:on    3:on    4:on    5:on    6:off
netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off

原文地址:https://www.cnblogs.com/qinyan20/p/11728493.html