转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 数据库 >> MySql >> 正文
MySQL5.0 Alpha & Create Procedure         ★★★★

MySQL5.0 Alpha & Create Procedure

作者:闵涛 文章来源:闵涛的学习笔记 点击数:1626 更新时间:2009/4/22 20:48:40
 程序员大本营 2004-02-02 


MySQL5.0 Alpha 發佈, 我們期待已久的 Create Function 和 Create Procedure 的功能終於有了. 詳細的資訊請參考 MySQL AB 的官方網站的 新聞. 早就想要的功能,出來了還不趕快試試.... 

本文以 Windows XP PRO os 為例< :) 我可不是有意來替 M$ 宣傳,只是我用的是 Windows,沒有辦法啦 >來說明,其它OS 類同, 先下載 MySQL5.0, 為了免除安裝,我們直接下載 Without installer  (unzip in C:\) 的版本,到 http://www.mysql.com/downloads/mysql-5.0.html 下載. 

1. 直接 unzip 後把其放到 C:\ 下, 並把 root Directory 改為 mysql(不改也可,那在 my.ini 中要把其中的 mysql 改為你的實際名稱) 

2. 下面是 my.ini 的配置文件,如果你對配置不熟的話,你可以直接 Copy 過去存為 my.ini 後放到 C:\windows 下即可 (我電腦的 RAM = 256) 
======================================================================================================== 
# Example mysql config file. 
# Copy this file to c:\my.cnf to set global options 

# One can use all long options that the program supports. 
# Run the program with --help to get a list of available options 

# This will be passed to all mysql clients 
[client] 
#password=my_password 
port=3306 
#socket=MySQL 

# Here is entries for some specific programs 
# The following values assume you have at least 32M ram 

# The MySQL server 
[mysqld] 
port=3306 
#socket=MySQL 
skip-locking 
set-variable = key_buffer=16M 
set-variable = max_allowed_packet=1M 
set-variable = table_cache=64 
set-variable = sort_buffer=512K 
set-variable = net_buffer_length=8K 
set-variable = myisam_sort_buffer_size=8M 
server-id = 1 

# Uncomment the following if you want to log updates 
#log-bin 

# Uncomment the following rows if you move the MySQL distribution to another 
# location 
#basedir = d:/mysql/ 
#datadir = d:/mysql/data/ 


# Uncomment the following if you are NOT using BDB tables 
#skip-bdb 

# Uncomment the following if you are using BDB tables 
#set-variable = bdb_cache_size=4M 
#set-variable = bdb_max_lock=10000 

# Uncomment the following if you are using Innobase tables 
innodb_data_file_path = ibdata1:400M 
innodb_data_home_dir = C:/mysql/InnoDB/ibdata # InnoDB 及 ibdata 的資料夾你要自己動手 
innodb_log_group_home_dir = C:/mysql/InnoDB/iblogs # iblogs 的資料夾同樣你要自己動手 
innodb_log_arch_dir = C:/mysql/innodb/iblogs 
set-variable = innodb_mirrored_log_groups=1 
set-variable = innodb_log_files_in_group=3 
set-variable = innodb_log_file_size=5M 
set-variable = innodb_log_buffer_size=8M 
innodb_flush_log_at_trx_commit=1 
innodb_log_archive=0 
set-variable = innodb_buffer_pool_size=16M 
set-variable = innodb_additional_mem_pool_size=2M 
set-variable = innodb_file_io_threads=4 
set-variable = innodb_lock_wait_timeout=50 

[mysqldump] 
quick 
set-variable = max_allowed_packet=16M 

[mysql] 
no-auto-rehash 
# Remove the next comment character if you are not familiar with SQL 
#safe-updates 

[isamchk] 
set-variable = key_buffer=20M 
set-variable = sort_buffer=20M 
set-variable = read_buffer=2M 
set-variable = write_buffer=2M 

[myisamchk] 
set-variable = key_buffer=20M 
set-variable = sort_buffer=20M 
set-variable = read_buffer=2M 
set-variable = write_buffer=2M 

[mysqlhotcopy] 
interactive-timeout 
[WinMySQLAdmin] 
Server=C:/mysql/bin/mysqld-nt.exe 
============================================================================ 

3. Create InnoDB table table space 如果運行沒有問題,你應該可以看到如下內容: 
========================================================== 

C:\mysql\bin>mysqld --console 
InnoDB: The first specified data file C:\mysql\InnoDB\ibdata\ibdata1 did not exist: 
InnoDB: a new database to be created! 
040113 15:12:54 InnoDB: Setting file C:\mysql\InnoDB\ibdata\ibdata1 size to 400 MB 
InnoDB: Database physically writes the file full: wait... 
InnoDB: Progress in MB: 100 200 300 400 
040113 15:13:19 InnoDB: Log file C:\mysql\InnoDB\iblogs\ib_logfile0 did not exist: new to be created 
InnoDB: Setting log file C:\mysql\InnoDB\iblogs\ib_logfile0 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
040113 15:13:19 InnoDB: Log file C:\mysql\InnoDB\iblogs\ib_logfile1 did not exist: new to be created 
InnoDB: Setting log file C:\mysql\InnoDB\iblogs\ib_logfile1 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
040113 15:13:20 InnoDB: Log file C:\mysql\InnoDB\iblogs\ib_logfile2 did not exist: new to be created 
InnoDB: Setting log file C:\mysql\InnoDB\iblogs\ib_logfile2 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
InnoDB: Doublewrite buffer not found: creating new 
InnoDB: Doublewrite buffer created 
InnoDB: Creating foreign key constraint system tables 
InnoDB: Foreign key constraint system tables created 
040113 15:13:26 InnoDB: Started; log sequence number 0 0 
mysqld: ready for connections. 
Version: ''''5.0.0-alpha-max-debug'''' socket: '''''''' port: 3306 
========================================================== 

安裝 Ok, 進去看看吧,沒想到一進 Mysql 馬上就來了個下馬威, 原來的 '''''''' 這個 user 不能用 mysql 的 databases 
========================================================= 
C:\mysql\bin>mysql 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 2 to server version: 5.0.0-alpha-max-debug 

Type ''''help;'''' or ''''\h'''' for help. Type ''''\c'''' to clear the buffer. 

mysql> use mysql 
ERROR 1044 (42000): Access denied for user: ''''''''@''''localhost'''' to database ''''mysql 
========================================================== 

沒有辦法,只有用 root 進去: 

========================================================== 

C:\mysql\bin>mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 5 to server version: 5.0.0-alpha-max-debug 

Type ''''help;'''' or ''''\h'''' for help. Type ''''\c'''' to clear the buffer. 

mysql> 

========================================================== 

:) root 的密碼還是勤快一點把它改掉吧 


4. 體驗一下 Create Function 吧 

CREATE FUNCTION MyFunc (s CHAR(20)) RETURNS CHAR(50) RETURN CONCAT(''''Hello '''',s,'''' DLL'''','''' !''''); 

========================================================== 
mysql> CREATE FUNCTION MyFu

[1] [2]  下一页


[Sql Server]Sql精妙语句--各种求值函数  [网页制作]网页表格之---多个表格纵向排列
[网页制作]JavaScript另类用法--读取和写入cookie  [网页制作]号称非常安全的上网工具---360安全浏览器介绍
[办公软件]信息技术教学篇---Word工具栏的显示、隐藏及四种菜…  [操作系统]开始菜单---运行命令大总结
[操作系统]网络转载---64位操作系统与32位的区别  [操作系统]ldap:///(没有响应)Windows无法访问指定设备、路径…
[网络技术]安全篇---交换机设置方法介绍  [聊天工具]Real10 & Xpdf installation on Linux Box
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Sql Server  · MySql
    · Access  · ORACLE
    · SyBase  · 其他
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台