MySQL数据库基础操作

忘记MySQL超户密码的解决方法 * MySQL数据库超户root 与centos超户root不是一个用户

登录数据库时出现以下提示时:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

  意思是 预读这个库中表以及表列信息,一般原因是当库中表很多,表中数据很大时,就会出现执行use <库名>后半天没反应,连接很慢的情况,解决办法就是 -A 方式登录数据库,不会预读库中表信息。

解决办法:[root@ns1 ~]# mysql -uroot -p -A

1】先暂停mysql服务

[root@ns1 ~]# /etc/init.d/mysqld stop

Shutting down MySQL.                                       [确定]

2】跳过grant表授权,计入安全模式,并在后台运行。

[root@ns1 ~]# mysqld_safe --skip-grant-tables & //skip(跳过)grant(授权)&后台

[root@ns1 ~]# jobs    //查询后台运行程序

  1. +  Running                 mysqld_safe --skip-grant-tables &

3】进入安全模式修改密码

[root@ns1 ~]# mysql    //登录数据库

...............................

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

mysql>  use mysql;  //进入MySQL数据库

Database changed

mysql>  update user set Password=password('123321') where user='root';

//update(修改数据)set(查看)password('123321') 调取函数必须添加() where(查询定位用户)

Query OK, 4 rows affected (0.01 sec)

Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;   // flush(刷新) privileges(权限)

Query OK, 0 rows affected (0.00 sec)

4】重启MySQL服务用新密码登录。

[root@ns1 ~]# /etc/init.d/mysqld restart   //重启MySQL服务

Shutting down MySQL.190509 06:20:15 mysqld_safe mysqld from pid file /usr/local/mysql/data/ns1.kgc.cn.pid ended

                                                           [确定]

Starting MySQL..                                           [确定]

  1. +  Done                    mysqld_safe --skip-grant-tables

[root@ns1 ~]# mysql -uroot -p123321   //新密码登录

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

...................................

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

mysql>

如何在MySQL数据库中开启使用tab键补全命令功能

1】修改配置文件/etc/my.cnf

vim /etc/my.cnf

132 [mysql]

133 #no-auto-rehash

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值