发布于 2016-03-08 21:38:31 | 195 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Mysql教程,程序狗速度看过来!

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。


在ubuntu下安装了mysql 5 server,结果不知道什么原因,安装时输入的root帐号密码在使用时无论如何都不能通过数据库服务器的验证。无奈只有重置mysql的root帐号密码。查了一下,用了以下方法成功的重置了root帐号密码
首先停止mysql服务:
 
root@webserver:/home/webmaster# service mysql stop 

接着采用忽略密码认证模式重新创建一个mysql服务:
 
root@webserver:/home/webmaster# mysqld --user=mysql --skip-grant-tables --skip-networking & 

成功启动后返回PID及其它启动信息
 
[1] 3591 
root@webserver:/home/webmaster# 121005 2:59:27 [Note] Plugin 'FEDERATED' is disabled. 
121005 2:59:27 InnoDB: The InnoDB memory heap is disabled 
121005 2:59:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
121005 2:59:27 InnoDB: Compressed tables use zlib 1.2.3.4 
121005 2:59:27 InnoDB: Initializing buffer pool, size = 128.0M 
121005 2:59:27 InnoDB: Completed initialization of buffer pool 
121005 2:59:27 InnoDB: highest supported file format is Barracuda. 
121005 2:59:27 InnoDB: Waiting for the background threads to start 
121005 2:59:28 InnoDB: 1.1.8 started; log sequence number 1595685 
121005 2:59:28 [Note] mysqld: ready for connections. 
Version: '5.5.24-0ubuntu0.12.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 0 (Ubuntu) 

连接到mysql系统库:
 
root@webserver:/home/webmaster# mysql -u root mysql 

连接到mysql库后直接修改root帐号的密码为新的密码'mynewpasswd':
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> update user set Password=PASSWORD('mynewpasswd') where user='root'; 
Query OK, 3 rows affected (0.00 sec) 
Rows matched: 3 Changed: 3 Warnings: 0 

mysql> FLUSH PRIVILEGES; 
mysql> quit; 
Bye 

中止mysql服务进程(PID 3591见前面启动服务时的屏幕信息):
 
root@webserver:/home/webmaster# kill 3591 

正常启动 mysql服务,并用新密码登录mysql服务器成功:
 
root@webserver:/home/webmaster#service mysql start 
root@webserver:/home/webmaster#mysql -u root -pmynewpasswd 


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务