询问 mysql的数据库 库名称如何更改
(表名是很简单的)
(表名是很简单的)
解决方案 »
- mysql中,向列字段中插入中文值,但显示为空。
- MySQL数据库 如何查看所有的主外键关系
- 什么都试了 就是连不上 使用ODBC来连MySQL
- 求MySQL中查询所有表空间和剩余表空间的命令
- 关于mysql的TRIGGER问题
- 如何使A表某【信息】删除B表【相关信息】也强制删除(A的主键是B的外键)
- mysql数据库,关于分类统计的SQL语句?
- 在servlet中使用MYSQL的驱程是什么?(WINDOWS下)
- 表外键与自己的主键关联(a foreign key constraint fails)
- 这种在生成小计行用sql写是如何做到的?
- 求助,请问怎么查询数据表中大于当前时间的记录呢??
- 我用.net查询“Select * From chuang_AgentInfo”可以,加个“Where `UserName`='成都' ” 就查不出来,郁闷
12.1.32. RENAME DATABASE Syntax
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;This statement was added in MySQL 5.1.7 but was found to be dangerous and was removed in MySQL 5.1.23. It was intended to enable upgrading pre-5.1 databases to use the encoding implemented in 5.1 for mapping database names to database directory names (see Section 8.2.3, “Mapping of Identifiers to File Names”). However, use of this statement could result in loss of database contents, which is why it was removed. Do not use RENAME DATABASE in earlier versions in which it is present. To perform the task of upgrading database names with the new encoding, use ALTER DATABASE db_name UPGRADE DATA DIRECTORY NAME instead (see Section 12.1.1, “ALTER DATABASE Syntax”).
[, tbl_name2 TO new_tbl_name2] ...
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 'database aa to bb' at line 1
mysql> RENAME DATABASE aa TO bb;
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 'DATABASE aa TO bb' at line 1
mysql>
不能用rename database aa to bb;
如何办??
不行sp_renamedb,在mysql里不行
然后直接改你的 datadir 中的数据库目录名。
创建测试用数据库XXXX,内含一表T1
mysql> create database xxxx;
Query OK, 1 row affected (0.00 sec)mysql> use xxxx;
Database changed
mysql> create table t1(id int);
Query OK, 0 rows affected (0.17 sec)mysql> drop table t1;
Query OK, 0 rows affected (0.08 sec)mysql> create table t1(id int) engine=myisam;
Query OK, 0 rows affected (0.05 sec)mysql> insert into t1 values (1),(2);
Query OK, 2 rows affected (0.06 sec)
Records: 2 Duplicates: 0 Warnings: 0mysql> select * from t1;
+------+
| id |
+------+
| 1 |
| 2 |
+------+
2 rows in set (0.00 sec)mysql>STOP MYSQL的服务。修改目录名XXXX 为YYYY[code=BatchFile]C:\Program Files\MySQL\MySQL Server 5.1\DATA>dir *.
Volume in drive C is ,
Volume Serial Number is , Directory of C:\Program Files\MySQL\MySQL Server 5.1\DATA09/29/2009 07:06p <DIR> .
09/29/2009 07:06p <DIR> ..
09/27/2009 10:40a <DIR> csdn
05/09/2009 02:09p <DIR> examples
09/29/2009 07:07p 18,874,368 ibdata1
09/29/2009 07:07p 25,165,824 ib_logfile0
06/18/2009 02:00p 25,165,824 ib_logfile1
07/08/2009 02:08p 51,117,989 .log
04/24/2009 02:41p <DIR> mysql
09/22/2009 10:54p <DIR> test
09/29/2009 07:06p <DIR> xxxx
4 File(s) 120,324,005 bytes
7 Dir(s) 27,343,729,152 bytes freeC:\Program Files\MySQL\MySQL Server 5.1\DATA>ren xxxx yyyyC:\Program Files\MySQL\MySQL Server 5.1\DATA>dir *.
Volume in drive C is ,
Volume Serial Number is , Directory of C:\Program Files\MySQL\MySQL Server 5.1\DATA09/29/2009 07:12p <DIR> .
09/29/2009 07:12p <DIR> ..
09/27/2009 10:40a <DIR> csdn
05/09/2009 02:09p <DIR> examples
09/29/2009 07:12p 18,874,368 ibdata1
09/29/2009 07:12p 25,165,824 ib_logfile0
06/18/2009 02:00p 25,165,824 ib_logfile1
07/08/2009 02:08p 51,117,989 .log
04/24/2009 02:41p <DIR> mysql
09/22/2009 10:54p <DIR> test
09/29/2009 07:07p <DIR> yyyy
4 File(s) 120,324,005 bytes
7 Dir(s) 27,343,524,864 bytes freeC:\Program Files\MySQL\MySQL Server 5.1\DATA>[/code]重启MYSQLD后再看。mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| csdn |
| examples |
| mysql |
| test |
| yyyy |
+--------------------+
6 rows in set (0.00 sec)mysql> select * from yyyy.t1;
+------+
| id |
+------+
| 1 |
| 2 |
+------+
2 rows in set (0.00 sec)mysql>
但是我的应用库表太多,导致显示不正常 ,(navcrat总是不时的说错误)
你上面是通过mysql民令看不出来太多的问题
如果java应用一连接 发生太多大问题根源
inofrmation_schema库
的schema表我的版本默认是不支持修改的,所以修改名称是失效的俄最后我用冷备份 解决(后来还是被我cut掉)
冷备份带来很大的问题 ,覆盖数据导致natcat还是不正常。 头疼
不知道那里出问题我的库 导入3小时以上, 发现free的软件这点还是不好
这个问题了结把我说的下面的问题很可能是5。0。45 的一个大bug
:备份一个数据库 (这个数据库每天都在使用 都在不停加新表 修改字段)
我备份了之后恢复 突然发现这个库不是最新的 表结构和字段,都是过时的表 和字段 (根据时间推测是6月份前的表字段和结构以及数据)
数据库几乎没有重启过。
我可以提供证据
其他几个人都遇到这个问题
100% 确定不是。
好象已经让你测试了。在你导出的 xxx.sql 中找到那个 create table 语句,看它是多少列,有没有少。
但似乎你没兴趣去查看。