标签 MySQL 下的文章

正则表达式 mysql字段转oracle一例

某mysql字段如下:
`test_id` int(11) not null auto_increment comment '自增字段',
而且有大量的这样字段需要转到oracle,首先我们知道oracle的字段描述里面是没有comment的,但是同时也需要保留comment信息。使用正则表达式来转换,用notepad++正则表达式替换:
查找目标:

comment(.*),

替换为:

,comment\1

\1表示的是(.*)的内容
最后替换为:
`staff_id` int(11) not null auto_increment ,-- '自增字段'
然后去掉反引号,去掉auto_increment,手动加上constraint primary key。

ERROR 1286 (42000): Unknown table engine ‘InnoDB’

I was getting the error “ERROR 1286 (42000): Unknown table engine ‘InnoDB’” when trying to create/alter tables with the InnoDB engine. You can check for this warning by issuing the create or alter statements and then running
show warnings;
in the same mysql client session.

Check if you have InnoDB support enabled:

mysql> show variables like 'have_innodb';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_innodb   | DISABLED   |
+---------------+-------+
1 row in set (0.04 sec)

The problem is that InnoDB is not enabled by default in Debian distributions of my.cnf. To enable it, simply comment the following lines under the [mysqld] section.

skip-innodb

via

DISABLED和NO是有区别的,DISABLED表示具有该功能,只是没有启用(通过启动参数or配置文件),NO表示彻底的不支持的编译版本。

MySQL版本: Alpha, Beta, Gamma, Production (Generally Available)

MySQL versions are identified by the attributes alpha, beta, gamma, and production:

Alpha means that the version is in the throes of the development process and that new functions and even incompatible changes are to be expected. Although an alpha version is not published until it contains no known errors, it is highly probable that many undiscovered errors still lurk within. Loss of data during testing of an alpha version is quite possible! Alpha versions are of interest only to developers who wish to try out the latest features of MySQL.

Beta means that this version is largely complete, but it has not been thoroughly tested. Major changes are not expected.

Gammameans that the beta versions have become more or less stable. The goal now is to discover errors and resolve them.

Production or Generally Available (GA) means that MySQL developers have the impression that the version is mature and stable enough that it can be used for mission-critical purposes. According to the MySQL documentation, in production versions, only corrections, and no new functionality, are to be expected. However, this has not always held true in the past, and even with stable versions substantial changes have been made. Of particular note is the case of MySQL 3.23.n. After the version had been declared stable (3.23.32), there came general support for InnoDB and BDB tables (3.23.34), and later, integrity rules for InnoDB tables (3.23.44). Furthermore, many minor extensions were introduced. As a rule, MySQL developers are pleased with such extensions, but at the same time, compatibility problems among different production versions can arise. In practice, this means that a new MySQL version (that is, n.n.0) always has the status alpha. With higher version numbers, the status rises to beta, gamma, and finally, production. Normal MySQL users should use exclusively MySQL versions that have the status production. If you are developing web applications, you should find out which version your Internet service provider is using. (Since Internet service providers are concernced with maintenance and stability, they are not generally keen on using the latest version, preferring earlier versions, which may not contain many of the functions of the newer versions.)

ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.119.105' (10061)

报错原因

  • 默认mysql是无法远程连接,需要修改mysql.user的Host字段,默认Host字段的的数据都是'127.0.0.1' 只能本地连接数据库,可以修改为'%',然后flush privileges;这样就可以远程访问了。如果这因为这个原因而无法远程访问的错误提示是:ERROR 1045 (28000): Access denied for user 'yushan'@'192.168.119.102' (using password: YES)。
  • 我在linux上安装了mysql,远程使用windows连接,结果提示:ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.119.105' (10061),找到这一句: bind-address           = 127.0.0.1 ,将其注释掉,然后sudo service mysql restart 重启动。可以连接了!
  • 如果是windows平台的mysql服务器无法被远程连接,可以禁用windows防火墙(net stop sharedaccess),mysql平台:/etc/init.d/iptables stop
  • 确认/etc/mysql/my.cnf文件skip-networking 选项也被注释掉。skip-networking的作用是禁用tcp/ip连接,彻底杜绝mysql远程连接。现在新版本都没有开启skip-networking。

在线选课系统

在线选课系统

在硬盘里面一个偏僻的角落翻出来的,上大二学《数据库》的课程设计写的在线选课系统,用的php+mysql。那个时候初学php,mysql,代码相当蛋疼,还有报错,但是勾起了很多美好的回忆。下载链接:http://tunps.com/lab/oes.rar