centos7 mariadb ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)

现在情况是这样的,将备份的数据导入到数据库里面,插入数据库是用的是mysql,操作系统是centos6.5,而备份的数据往数据库插用的是mariadb,操作系统是centos7。在centos7出现各种问题,有时候新不一定是最好的。

安装mariadb是默认的,打开命令行窗口,直接输入mysql,就可以。之前没有注意到root下的磁盘空间,插到一半,空间满了,可能数据太大了,40多个G。满了,把之前默认数据路径ibdata1,移动到空间更大的地方。移完后,就各种问题,其中权限问题,纠结了一上午。
最上面的问题:往数据库里导数据 指令是:mysql bigdata < /home/data/backdata8.sql 出现了 ERROR 1045 (28000): Access denied for user root@localhost (using password: NO),
最终解决方法,添加一个新的用户就可以了,不用设置密码。–skip-grant-tables 跳过表权限。

今天早上又出现同样的问题,修改密码,之前是默认安装mariadb,是没有密码的。修改

[root@localhost /]# mysql_secure_installation
/usr/bin/mysql_secure_installation:行379: find_mysql_client: 未找到命令

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): 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
下面是修改成功后,又重新敲了这条指令--skip-grant-tables 跳过表权限,就可以了,查看的日志文件
150321 10:20:56 [Warning] IP address '10.10.108.120' could not be resolved: Name 
or service not known
150321 10:23:36 mysqld_safe A mysqld process already exists
150321 10:23:44 mysqld_safe A mysqld process already exists
150321 10:24:11 [Note] /usr/libexec/mysqld: Normal shutdown

150321 10:24:11  InnoDB: Starting shutdown...
150321 10:24:12  InnoDB: Shutdown completed; log sequence number 67596365091
150321 10:24:12 [Note] /usr/libexec/mysqld: Shutdown complete

150321 10:24:12 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid end
ed
150321 10:24:17 mysqld_safe Starting mysqld daemon with databases from /home/data
/
150321 10:24:17 InnoDB: The InnoDB memory heap is disabled
150321 10:24:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150321 10:24:17 InnoDB: Compressed tables use zlib 1.2.7
150321 10:24:17 InnoDB: Using Linux native AIO
150321 10:24:17 InnoDB: Initializing buffer pool, size = 128.0M
150321 10:24:17 InnoDB: Completed initialization of buffer pool
150321 10:24:17 InnoDB: highest supported file format is Barracuda.
150321 10:24:17  InnoDB: Waiting for the background threads to start
150321 10:24:18 Percona XtraDB (http://www.percona.com) 5.5.40-MariaDB-36.1 start
ed; log sequence number 67596365091
150321 10:24:18 [Note] Plugin 'FEEDBACK' is disabled.
150321 10:24:18 [Note] Server socket created on IP: '0.0.0.0'.
150321 10:24:18 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.41-MariaDB'  socket: '/home/data/mysql/mysql.sock'  port: 3306  Mar
iaDB Server
150321 10:27:40 [Note] /usr/libexec/mysqld: Normal shutdown

150321 10:27:40  InnoDB: Starting shutdown...
150321 10:27:41  InnoDB: Shutdown completed; log sequence number 67596365091
150321 10:27:41 [Note] /usr/libexec/mysqld: Shutdown complete

150321 10:27:41 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid end
ed
150321 10:27:53 mysqld_safe Starting mysqld daemon with databases from /home/data
/
150321 10:27:53 InnoDB: The InnoDB memory heap is disabled
150321 10:27:53 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150321 10:27:53 InnoDB: Compressed tables use zlib 1.2.7
150321 10:27:53 InnoDB: Using Linux native AIO
150321 10:27:53 InnoDB: Initializing buffer pool, size = 128.0M
150321 10:27:53 InnoDB: Completed initialization of buffer pool
150321 10:27:53 InnoDB: highest supported file format is Barracuda.
150321 10:27:53  InnoDB: Waiting for the background threads to start
150321 10:27:54 Percona XtraDB (http://www.percona.com) 5.5.40-MariaDB-36.1 start
ed; log sequence number 67596365091
150321 10:27:54 [Note] Plugin 'FEEDBACK' is disabled.
150321 10:27:54 [Note] Server socket created on IP: '0.0.0.0'.
150321 10:27:54 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.41-MariaDB'  socket: '/home/data/mysql/mysql.sock'  port: 3306  MariaDB Server
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值