记录一次奇葩的mariadb不能启动解决方法:
方法 解决 启动 记录 不能 一次 MariaDB 奇葩
2023-09-11 14:22:20 时间
一、先是不能启动服务:
错误提示大概:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
1、关闭mysql数据库服务
systemctl stop mysqld
2、屏蔽权限
mysqld_safe --skip-grant-table
3、新开起一个终端输入:
mysql -u root mysql
delete from user where USER='';
FLUSH PRIVILEGES;//记得要这句话,否则如果关闭先前的终端,又会出现原来的错误
exit
二、重新启动系统后,启动过程
1、开启mysql数据库服务 systemctl start mysqld
2、登陆mysql, mysql -u root -p 提示ERROR 1698 (28000): Access denied for user 'root'@'localhost'
3、继续忽略权限:mysqld_safe --skip-grant-table
4、超级用户登陆mysql:sudo mysql -u root -p
输入密码:用户密码
输入密码:mysql root密码:
三、添加自己启动:
下次开机的时候记得启动服务,要不然会报错:
systemctl start mariadb
当然也可以开机自启动.但是我觉得自己启动比较舒服:
systemctl enable mariadb #自启动
systemctl disable mariadb #关闭自启动
四、解决只能root用户使用mysql命令的方法:
1、su 切换到超级用户,记得输入root密码
2、mysql 登陆数据库
3、见下面内容:
1 MariaDB [(none)]> use mysql; 2 Reading table information for completion of table and column names 3 You can turn off this feature to get a quicker startup with -A 4 5 Database changed 6 MariaDB [mysql]> show tables; 7 +---------------------------+ 8 | Tables_in_mysql | 9 +---------------------------+ 10 | column_stats | 11 | columns_priv | 12 | db | 13 | event | 14 | func | 15 | general_log | 16 | global_priv | 17 | gtid_slave_pos | 18 | help_category | 19 | help_keyword | 20 | help_relation | 21 | help_topic | 22 | index_stats | 23 | innodb_index_stats | 24 | innodb_table_stats | 25 | plugin | 26 | proc | 27 | procs_priv | 28 | proxies_priv | 29 | roles_mapping | 30 | servers | 31 | slow_log | 32 | table_stats | 33 | tables_priv | 34 | time_zone | 35 | time_zone_leap_second | 36 | time_zone_name | 37 | time_zone_transition | 38 | time_zone_transition_type | 39 | transaction_registry | 40 | user | 41 +---------------------------+ 42 31 rows in set (0.001 sec) 43 44 MariaDB [mysql]> show user; 45 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 'user' at line 1 46 MariaDB [mysql]> create user 'gsc'@'%' identified by '设置的密码'; 47 Query OK, 0 rows affected (0.056 sec) 48 49 MariaDB [mysql]> grant select on *.* to 'gsc'@'%'; 50 Query OK, 0 rows affected (0.040 sec) 51 52 MariaDB [mysql]> flush privileges; 53 Query OK, 0 rows affected (0.001 sec) 54 55 MariaDB [mysql]> exit 56 Bye 57 [developRos WORKM]# exit 58 exit 59 nication ~ WORKM mysql -ugsc -p刚设置的密码 60 Welcome to the MariaDB monitor. Commands end with ; or \g. 61 Your MariaDB connection id is 21 62 Server version: 10.5.8-MariaDB Arch Linux 63 64 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. 65 66 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 67 68 MariaDB [(none)]>
相关文章
- 下载Twitter视频的3种方法
- 学习MongoDB 三: MongoDB无法启动的解决方法
- Windows Server2012 R2 无法安装.NET Framework 3.5的解决方法
- 在启动php时,无法启动此程序,由于计算机中丢失MSVCR110.dll的解决方法
- 【Asp.net】运行项目提示“未能加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配”的解决方法(已解决)
- Git冲突与解决方法
- win 10找不到恢复环境怎么办?三种方法带你解决!
- win10开机启动慢如何解决?三种方法帮你解决!
- 你没有权限在此位置保存文件请与管理员联系的解决方法
- [Google Guava] 1.3-常见Object方法
- [转]Null value was assigned to a property of primitive type setter of"原因及解决方法
- sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class异常解决方法
- from torch._C import * ImportError: DLL load failed解决方法
- Linux启动ftp服务器530 Permission denied解决方法(已试,行)
- 关于ELF可执行文件转换为bin二进制文件反而变大带来的思考和解决方法
- vs code中终端中的命令不能使用的解决方法
- Tomcat在阿里云Centos7上正常启动,但浏览器无法访问的解决方法
- 中文字和英文字的写字方法
- 【福利!】英雄联盟国服更新补丁速度极慢的解决方法
- mysql5.5无法启动,Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 问题的解决方法
- Tomcat 启动startup.bat闪退的解决方法
- C#Winform频繁刷新导致界面闪烁解决方法
- 工具及方法 - Outlook里创建邮件规则
- manjaro更新到了20版本fcitx5出问题的解决方法
- 在默认的设置下SQL Server不允许进行远程连接可能会导致此失败,“登录超时已过期“--的解决方法