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

MySQL Basic Knowledge

MySQL版本: Server version: 5.1.44 Source distribution
修改root密码
如果没有密码使用下面的命令, 将密码设为"123456"
$ mysqladmin -u root password 123456
如果有密码使用下面的命令, 将密码改为"123456"
$ mysqladmin -u root -p password 123456
Enter password:
用户账户管理
添加账户:
http://dev.mysql.com/doc/refman/5.1/zh/database-administration.html#user-account-management
提到的方法不适用:
mysql>
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'

IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
根据http://dev.mysql.com/doc/refman/5.1/en/adding-users.html所说, 要先create user, 然后再使用grant, 根据尝试, 在mysql中, 语句不区分大小写. 正确的方法如下:
mysql> create user 'frank'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'frank'@'localhost' INDENTIFIED BY '123456' WITH GRANT OPTION;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INDENTIFIED BY '123456' WITH GRANT OPTION' at line 1
mysql> GRANT ALL PRIVILEGES ON *.* TO 'frank'@'localhost' WITH GRANT OPTION;Query OK, 0 rows affected (0.00 sec)
mysql>
以上语句创建了名为"frank"的用户,  密码为"123456", 该用户为超级用户, 只能从local host登录.
mysql> create user 'frank'@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'frank'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql>
上面的语句创建了名为"frank"的超级用户, 密码为"123456", 该用户可以从任意主机登录. 创建localhost的"frank"用户是必须的:
It is necessary to have both accounts for
monty
to be able to connect from anywhere
as monty
. Without the
localhost
account, the anonymous-user
account for localhost
that is created by
mysql_install_db
would take precede


相关文档:

应用访问Mysql遇到的连接问题

最近在做一个小项目,开发环境:数据库mysql5.0,服务器Tomcat5.5。项目打成war部署在tomcat上之后,通过应用进行查询操作,如果操作过于频繁,后台会抛如下异常:
javax.servlet.ServletException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [08S01]; error co ......

MYSQL和ORACLE的一些操作区别

有很多应用项目, 刚起步的时候用MYSQL数据库基本上能实现各种功能需求,随着应用用户的增多,数据量的增加,MYSQL渐渐地出现不堪重负的情况:连接很慢甚至宕机,于是就有把数据从MYSQL迁到ORACLE的需求,应用程序也要相应做一些修改。本人总结出以下几点注意事项,希望对大家有所帮助。
1.自动增长的数据类型处理
MYSQL有 ......

mysql 子查询删除记录

    mysql 可以通过子查询得到要删除的记录条件,然后通过子查询得结果匹配要删除的记录。但是 mysql 不能直接删除子查询表中的数据,必须通过一个临时表来解决。例如:
    delete from t_transaction where exists
    (select d.* from t_ti_category a,t_category b,t_ ......

nagios监控mysql主从复制


下手处:登陆mysql从服务器,通过执行 mysql> show slave status\G 查看其输出,即可判定主从复制是否正常。下面是监控MYSQL复制某个从服务器的输出:
mysql> show slave status\G
*************************** 1. row ***************************
         &nbs ......

MySQL命令行中文乱码问题解决

问题:
1、数据库默认的字符集设置为UTF-8;
2、通过ibatis读写数据中文正常;
3、但是用windows命令行执行select语句中文显示乱码。
解决:
数据库用户登录时参数设定字符集:
mysql --default-character-set=gb2312 -u 用户名 -p
(估计和windows的cmd命令行有关) ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号