存在宇宙之中 长在地球之上分享 http://blog.sciencenet.cn/u/wangchangzai

博文

mysql数据库相关问题

已有 3241 次阅读 2014-4-15 10:10 |个人分类:生活点滴|系统分类:科研笔记

一、安装mysql数据库,service mysql start 有错误

Starting MySQL.Manager of pid-file quit without updating file.      failed,

我是suse11,mysql的错误日志在/var/lib/mysql下,在mysql文件夹下查找*.err,找到错误的原因。

我遇到的问题是140415  9:28:44 [ERROR] Plugin 'InnoDB' init function returned error.140415  9:28:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed

解决方案:现在需要做的事情就是把原来的 innodb 的ib_logfile×备份到一个目录下,然后删除掉原来的文件,重启 mysql。
你会看到ib_logfile*大小变成了你配置文件中指定的大小。

二、设置mysql密码:

首先应为root用户

方法1、mysqladmin -u root password 'new-password'

方法2、# mysql
       进入到mysql
      mysql > USE mysql;
       更新user表数据
       mysql > UPDATE user SET password = PASSWORD(‘密码’) WHERE user = ‘root’;
        mysql > FLUSH PRIVILEGES;

三、mysql数据库忘记密码

1、编辑MySQL配置文件my.cnf

#vi /etc/my.cnf #编辑文件,找到[mysqld],在下面添加一行skip-grant-tables

[mysqld]

skip-grant-tables

#:wq! #保存退出

#shutdown -r now #重启系统

2、进入MySQL控制台

#mysql -uroot -p #直接按回车,这时不需要输入root密码。

3、修改root密码

    mysql >update mysql.user set password=password('111111') where User="root" and Host="localhost";

    mysql >flush privileges; #刷新系统授权表

4、取消/etc/my.cnf中的skip-grant-tables

#vi /etc/my.cnf 编辑文件,找到[mysqld],删除skip-grant-tables这一行

#:wq! #保存退出

5、重启mysql

#service mysqld restart #重启mysql,这个时候mysql的root密码已经修改为111111

6、进入mysql控制台

#mysql -uroot -p #进入mysql控制台

111111 #输入密码







https://blog.sciencenet.cn/blog-295036-785064.html

上一篇:linux 安装sac
下一篇:perl学习笔记
收藏 IP: 218.247.1.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-20 05:52

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部