可以在mysql的文件中改密码_四种在MySQL中修改root密码的方法

四种在MySQL中修改root密码的方法

<>整理了以下四种在MySQL中修改root密码的方法,可能对大家有所帮助!

方法1: 用SET PASSWORD命令

mysql -u root

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');

方法2:用mysqladmin

mysqladmin -u root password "newpass"

如果root已经设置过密码,采用如下方法

mysqladmin -u root password oldpass "newpass"

方法3: 用UPDATE直接编辑user表

mysql -u root

mysql> use mysql;

mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';

mysql> FLUSH PRIVILEGES;

在丢失root密码的时候,可以这样

mysqld_safe --skip-grant-tables&

mysql -u root mysql

mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';

mysql> FLUSH PRIVILEGES;

转自:http://shansren.blog.51cto.com/936097/215027

相关文档:

这里是一个使用日期函数的例子。下面的查询选择了所有记录,其date_col的值是在最后30天以内:

mysql> SELECT something from table

WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;

DAYOFWEEK(date)

返回日期date的星期索引(1=星期天,2=星期一, ……7=星期六)。这些索引值对应于ODBC标 ......

//主键

alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);

//增加一个新列

alter table t2 add d timestamp;

alter table infos add ex tinyint not null default '0';

//删除列

alter table t2 drop column c;

//重命名列

......

solaris下mysql安装完毕后执行如下操作,可以修改数据库字符集,设置MySQL在Solaris上表名不区分大小写

1.拷贝文件如下:

cp /usr/sfw/share/mysql/my-medium.cnf /etc/my.cnf

把文件只读属性去掉

chmod +w my.cnf

2 设置mysql的字符集:在/etc/my.cnf中的mysqld段和client段加入代码:

[client]

de ......

http://www.developer.com/java/data/article.php/3417381/Using-JDBC-with-MySQL-Getting-Started.htm#Preface

Preface

Purpose

The purpose of this lesson is to get you beyond the initial hurdles involved in:

Downloading and installing a MySQL database server.

Preparing that database for use with JDBC ......

很久没有用Mysql了,发现小小的时间问题也遇到不少麻烦,呵呵

所以总结一下:

第一种:

Date time= new java.sql.Date(new java.util.Date().getTime());

第二种:

java 用PreparedStatement来setDate,用问号的形式给日期问号赋值

pstmt.setTimestamp(8, new Timestamp(System.currentTimeMillis()));

pst ......

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值