July
4th
2009

三种方法恢复MySQL密码

实用技巧 1条评论

评分: 很差劲不怎样还可以还不错太棒了
Loading ... Loading ...

方法一

MySQL的密码是存储在数据库mysql中的user表中,我们需要在windows 2003下安装一个新的MySQL,然后将这个MySQL中的user表拷贝过来覆盖。

在MySQL的安装目录的 data\mysql\ 目录下有三个user表相关文件
user.frm //user表样式文件
user.MYD //user表数据文件
user.MYI //user表索引文件
将三个都拷贝过来(不过其实如果之前在要恢复的那个MySQL上没有更改过表结构的话,只要拷贝user.MYD就行了)
然后运行

#./etc/rc.d/init.d/mysql stop
#./etc/rc.d/init.d/mysql start
#mysql -u root -p XXXXXX

现在用windows 2003下的MySQL密码登陆

mysql>use mysql;
mysql>update user set Password=PASSWORD(’xxxxxx’) where User=’root’;

这时候会出错,提示user表只有读权限。这是因为在windows 2003下user.*文件分配的权限是666,拷贝到后权限变成了600。其实正常情况下600是可以运行的,只是这些文件拷过来后的所有者是root,所以会出现权限不够警告,需要使用以下命令

#chown -R mysql:mysql user.*
#chmod 600 user.*

重起一下MYSQL后重新进入数据库

mysql>use mysql;
mysql>update user set Password=PASSWORD(’xxxxxx’) where User=’root’;
mysql>FLUSH PRIVILEGES;

值得注意的一点是,如果你windows下MySQL如果是默认配置的话,还需要执行以下命令

mysql>delete from user where User=”;
mysql>delete from user where Host=’%';
mysql>FLUSH PRIVILEGES;

到此恢复密码过程就完成了。这个方法局限性在于,你必须具备另外的user表文件。


April
19th
2007

Use MySQL in Java on Windows

电脑技术 没有评论

评分: 很差劲不怎样还可以还不错太棒了
Loading ... Loading ...

In order to run MySQL through Java’s JDBC, you will need the MySQL installation file and the MySQL driver. Both of these are available from the course web site through these links jdk-6-windows-i586.exe mysql-5.0.27-win32.zip mysql-connector-java-5.0.4.zip All represent the latest release versions at the time of writing. These packages are available (in the truly latest versions) for download from the respective home sites:

Software Download
Java http://java.sun.com/javase/downloads/index.jsp
MySQL http://www.mysql.com/downloads/
MySQL
Connector/J
http://www.mysql.com/downloads/


January
13th
2007

Apache2, SSL, Mysql, PHP and OpenLDAP Installation Guide

电脑技术 3条评论

1次评分, 平均分: 1 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 5
评分: 很差劲不怎样还可以还不错太棒了
Loading ... Loading ...

1. Install Mysql

  1. #groupadd mysql
  2. #adduser mysql -g mysql -s /nologin
  3. #cd mysql-VERSION/
  4. #./configure --prefix=/usr/local/mysql
  5. #make && make install
  6. #scripts/mysql_install_db
  7. #chown -R root:mysql /usr/local/mysql
  8. #chown -R mysql /usr/local/mysql/var
  9. #/usr/local/mysql/bin/mysqld_safe --user=mysql
  10. #mysql -uroot
  11. >use mysql;
  12. >update user set password=password('XXX') where user='root';
  13. >flush priviledges;