在mysql数据库中修改root的密码
下面我给大家介绍几种在mysql数据库中修改root密码的方法
方法一:
原始密码是 ckh
mysql -uroot -pckh
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.0.22-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> update user set password=password('newpass') where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
方法二:
原始密码是 newpass , 新密码是 mysql
mysqladmin -uroot -pnewpass password mysql
方法三
原始密码是 mysql , 新密码是 ckh
mysql -uroot -pmysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19 to server version: 5.0.22-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> set password for root@'localhost'=password('ckh');
Query OK, 0 rows affected (0.00 sec)
mysql>
下面列出一些常用的mysql数据库管理命令:
安装 利用RPM包安装Mysql
设置TCP 3306端口的iptables
root密码管理 设置root用户的密码 mysqladmin -uroot password 'password'
修改root用户的密码 mysqladmin -uroot -p password 'password'
数据库,表管理 进入mysql mysql -h hostname -uroot -p
创建数据库 mysql> create database location
导入数据结构 mysql -uroot -p
相关文档:
Some problems encounted this afternoon, when trying to setup/test mysql capabilities on hypnos and virgil.
1.ERROR 2003 (HY000): Can't connect to MySQL server on 'server-name' (111)
access locally (i.e. from localhost) is fine, when trying remotely got this error. when tried with mysql++ library, ......
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。
2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎
放弃使用索引而进行全表扫描,如:
select id from t where num is null
可以在num上设置
默认值0,确保表中num列没有null值,然后这
样查询:
sel ......
MySQL密码修改方法
首先要声明一点,大部分情况下,修改MySQL是需要有mysql里的root权限的,所以一般用户无法更改密码,除非请求管理员。
方法一
使用phpmyadmin,这是最简单的了,修改mysql库的user表,
不过别忘了使用PASSWORD函数。
方法二
......
MySQL数据库日志
select日志
slow select日志
变更日志
二进制变更日志(binlog)
告警日志
错误日志。
可以在my.cnf中配置
参数
说明
log
文本select日志,记下所有的MySQL的命令操作,
log-update
文本变更日志
log-bin
这个都知道了,数据库复制的时候必备
binlog_cache_size
临时存放某次事务的SQL ......
InnoDB,普通的mysql
dump备份下来,mysql恢复起来慢得要
死.
于是网上找了好久,才找到这么个工具
.
http://launchpad.net/percona-xtrabackup/release-1.2/release-1.2/+download/xtrabackup-1.2.tar.gz
先测试下再说.
可以这么备份:
MyISAM
表:
/usr/local/mysql/bin/mysqldump -uyejr -pyejr
--default-char ......