ubuntu 下mysql使用方法简介及mysql密码丢失的修复
来源:互联网 发布:windows修改快捷键 编辑:程序博客网 时间:2024/06/05 22:15
ubuntu 下mysql使用方法简介
参考
http://hi.baidu.com/fancx/blog/item/4b91d82a5c66582bd42af1ca.html
http://hi.baidu.com/cnlen/blog/item/eb1251661646c820aa184c20.html
一、密码丢失的修复
l 停止MYSQL服务器:
$sudo /etc/init.d/mysql stop
收到打印信息
* Stopping MySQL database server mysqld [ OK ]
l 跳过授权表执行MYSQL服务器:
$sudo mysqld_safe --skip-grant-tables --skip-networking &
(注:参数--skip-grant-tables为跳过授权表;--skip-networking为不监听TCP/IP连接)
收到打印信息
[1] 8292 nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[8334]: started
l 执行MYSQL客户端:
$mysql
收到打印信息
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 1
Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)
Type 'help;' or '/h' for help. Type '/c' to clear the buffer.
mysql>
l 使用mysql数据库
mysql>use mysql;
收到打印信息
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
l 更新root密码
mysql>update user set password='' where user='root';
这里是加一个空密码给root;
收到打印信息
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
l 退出mysql数据库
mysql> exit
收到打印信息
Bye
l 重新启动mysql服务器
$sudo /etc/init.d/mysql start
l 重新设置密码
$sudo /use/bin/mysqladmin -u root password 123456
通过上面的命令,我们可以知道,mysql数据库的管理员是root,密码是123456。
二,mysql基本操作
进入mysql数据库
$mysql -uroot -p123456
常用命令
mysql>create database db1; #创建数据库;
mysql>show databases; #查看系统中数据库;
mysql>use db1; #指定要操作的数据库名称;
mysql>create tables tab1; #在db1数据库中创建表tab1;
mysql>show tables; #查看db1数据库包含的数有数据表;
mysql>drop database db1; #删除数据库db1;
mysql>drop table tab1; #删除db1数据库中的表tab1;
mysql>desc tab1; #查看tab1表的结构;
mysql>select * from tabl; #查看表tab1的所有项;
- ubuntu 下mysql使用方法简介及mysql密码丢失的修复
- mysql linux下密码丢失的解决方案
- mysql mac 下丢失密码的恢复
- ubuntu系统下使用xampp 丢失mysql root密码
- MySQL修改root密码及丢失密码的解决方法
- 丢失mysql密码情况下修改密码
- Windows下丢失mysql root密码后的详细解决方法
- Linux下mysql的root密码丢失重置
- mysql服务丢失后的修复
- Mysql服务器丢失后的修复
- linux下mysql root密码丢失
- windows下mysql root密码丢失怎么办?
- Ubuntu下重置MySQL的root密码
- Ubuntu下mysql忘记密码的解决办法
- Ubuntu下mysql忘记密码的解决办法
- mysql root密码丢失
- mysql root密码丢失
- mysql root密码丢失
- WINCE下写TXT文件
- 菜鸟学习OGRE和天龙八部之八: 水面方格效果和光照BUG的修正
- 海量GIS文章,软件教程,GIs编程奉送!!(转)
- 近期MFC使用小结
- 我写的银行家算法的一个显示函数
- ubuntu 下mysql使用方法简介及mysql密码丢失的修复
- NBA比赛时间 2009-2010
- ZTE中兴密码猎取
- VxWorks基本模块
- 主板前置USB插线接法大全
- c# 调用Google查询天气 手机所属地 农历转换公历
- MyEclipse的常用快捷键
- jAVA jdk的配置
- 循环链表