修改MySQL默认密码的具体步骤(转)
access denied for user 'root'@'localhost' (using password: YES);
今天用mysql的时候,登录的时候出现了这句,不知道是什么意思,因为我的mysql是装centos的时候一起装的,密码我就输入我的帐户密码,结果出现了上面那句;百度了一下,还真不少人出现了这个问题。。最后我找到了方法;
[root@localhost home]# mysql -u root
mysql>set password for 'root'@'localhost'=password('newpasswd');
mysql>set password for 'root'@'%'=password('newpasswd'); //本条可选通过以上设置,root的密码将变为newpasswd这样就完成了根用户root密码的设置工作
就是按照这个方法 我进去了。。
相关文档:
by ZaraByte
How to do a SQL Injection for MYSQL Server 5.0+
1. Find a vulnerable add a ‘ at the end of the site example: news.php?id=1 add a ‘ at the end of the 1 and see if you get a syntax error
2. order by #–
Keep upping the # until you get an error.
3. union all select 1 ......
一、设置数据库编码
安装mysql时可选择编码,如果已经安装过,可以更改文件my.ini(此文件在mysql的安装目录下)中的配制以达到目的;打开文件找到两处:
[client]
port=3306
[mysql]
default-character-set=gb2312
# The default character set that will be used when a new
schema or table is
# created and
n ......
一、建表
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`ID` int(11) NOT NULL auto_increment,
`NAME` varchar(16) NOT NULL default '',
`REMARK` varchar(16) NOT NULL default '',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
&nb ......
基本的MySQL语句很简单,这里主要谈谈一些容易遗忘的。
1.如何设置字段递增
create table tb_User(Id int auto_increment
not null primary key,UserName varchar(50),Password varchar(20));
2.查看表结构
desc tb_User;
3.如何修改表结
重命名表:alter table tb_User rename
tb_UserInfo;
添加一列:alter ta ......