易截截图软件、单文件、免安装、纯绿色、仅160KB

mysql 恢复被删的 root 账户

.关闭现有mysql
.不加载grant_tables而进入mysql
D:\>mysqld-nt --skip-grant-tables OR mysqld_safe --skip-grant-tables
.新开一个cmd窗口,然后按下面执行
D:\>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.27-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> select * from user;
Empty set (0.00 sec)
mysql> insert into user set user='root',ssl_cipher='',x509_issuer='',x509_subject='';
Query OK, 1 row affected, 3 warnings (0.00 sec)
(这时可能会提示某字段如ssl_cipher无默认值, 只要加上,ssl_cipher=''; 其字段如有提示依次添加就OK了)
mysql> update user set Host='localhost',select_priv='y', insert_priv='y',update_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';
mysql> quit
Bye
关闭mysql
D:\> mysqladmin shutdown
2)带权限正常启动mysql
D:\>mysqld-nt OR
3)新开一个cmd窗口
D:\>mysql  -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.27-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> update user set password=password('123456') where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> flush privileges;
mysql> quit
试下没有密码时进入mysql
D:\>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用密码进入mysql
D:\>mysql -u root -p123456
Welcome to the MySQL monito


相关文档:

Mysql的字符串函数

前注:对于针对字符串位置的操作,第一个位置被标记为1。
ASCII(str) 返回字符串str的最左面字符的ASCII代码值。如果str是空字符串,返回0。如果str是NULL,返回NULL。
mysql> select ASCII('2');
-> 50
mysql> select ASCII(2);
-> 50
mysql> select ASCII('dx');
-> 1 ......

Mysql的日期和时间函数

这里是一个使用日期函数的例子。下面的查询选择所有 date_col 值在最后 30 天内的记录。
mysql> SELECT something from tbl_name
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
DAYOFWEEK(date) 返回 date 的星期索引(1 = Sunday, 2 = Monday, ... 7 = Saturday)。索引值符合 ODBC 的标准。
mysq ......

最简单的配置mysql免安装版本的方法

为了让用户不需要自己运行mysql安装程序安装mysql数据库,软件发布时需要打包免安装版本的mysql。从mysql官网上直接下载的免安装版本需要各种配置,如果配置不好,很容易产生各种各样的问题。尤其是错误码为1067的问题,我试验了网上的很多方法都没起作用,最后想了一个最简单的方法:
    (1)首先使用安 ......

linux下mysql编译安装方法备忘

# tar -zxvf mysql-5.0.45.tar.gz -C /usr/src/
# cd /usr/src/mysql-5.0.45
# ./configure --prefix=/usr/local/mysql --with-charset=gbk
--localstatedir=/usr/local/mysql/data
# make
# make install
# groupadd mysql
# useradd mysql -g mysql
# cd /usr/local/mysql/bin
# ./mysql_install_db --user=mys ......

mysql复制表

我们经常会遇到需要表复制的情况,如将一个table1的数据的部分字段复制到table2中,或者将整个table1复制到table2中,这时候我们就要使用SELECT INTO 和 INSERT INTO SELECT 表复制语句了。
1.INSERT INTO SELECT语句
      语句形式为:Insert into Table2(field1,field2,...) select value1,v ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号