CentOS5.3 - mysql-6.0.10-alpha 源代码和设置

mysql\u8bbe\u7f6e\u4e3b\u952e\u7684\u4ee3\u7801\u662f\u4ec0\u4e48\uff1f

mysql\u8bbe\u7f6e\u4e3b\u952e\u7684\u4ee3\u7801\u662fPRIMARY KEY \uff08\u4e3b\u952e\u5b57\u6bb5\uff09\u3002
\u5982\uff1aCREATE TABLE Customer \uff08SID integer\uff0cLast\uff3fName varchar\uff0830\uff09\uff0cFirst\uff3fName varchar\uff0830\uff09\uff0cPRIMARY KEY \uff08SID\uff09\uff09\u3002
\u4e3b\u5173\u952e\u5b57\uff08\u4e3b\u952e\uff0cprimary key\uff09\u662f\u88ab\u6311\u9009\u51fa\u6765\uff0c\u4f5c\u8868\u7684\u884c\u7684\u552f\u4e00\u6807\u8bc6\u7684\u5019\u9009\u5173\u952e\u5b57\u3002\u4e00\u4e2a\u8868\u53ea\u6709\u4e00\u4e2a\u4e3b\u5173\u952e\u5b57\u3002\u4e3b\u5173\u952e\u5b57\u53c8\u53ef\u4ee5\u79f0\u4e3a\u4e3b\u952e\u3002


\u6269\u5c55\u8d44\u6599\uff1a
\u6c38\u8fdc\u4e5f\u4e0d\u8981\u66f4\u65b0\u4e3b\u952e\u3002\u5b9e\u9645\u4e0a\uff0c\u56e0\u4e3a\u4e3b\u952e\u9664\u4e86\u552f\u4e00\u5730\u6807\u8bc6\u4e00\u884c\u4e4b\u5916\uff0c\u518d\u6ca1\u6709\u5176\u4ed6\u7684\u7528\u9014\u4e86\uff0c\u6240\u4ee5\u4e5f\u5c31\u6ca1\u6709\u7406\u7531\u53bb\u5bf9\u5b83\u66f4\u65b0\u3002\u5982\u679c\u4e3b\u952e\u9700\u8981\u66f4\u65b0\uff0c\u5219\u8bf4\u660e\u4e3b\u952e\u5e94\u5bf9\u7528\u6237\u65e0\u610f\u4e49\u7684\u539f\u5219\u88ab\u8fdd\u53cd\u4e86\u3002
\u4e3b\u952e\u5e94\u5f53\u7531\u8ba1\u7b97\u673a\u81ea\u52a8\u751f\u6210\u3002\u5982\u679c\u7531\u4eba\u6765\u5bf9\u4e3b\u952e\u7684\u521b\u5efa\u8fdb\u884c\u5e72\u9884\uff0c\u5c31\u4f1a\u4f7f\u5b83\u5e26\u6709\u9664\u4e86\u552f\u4e00\u6807\u8bc6\u4e00\u884c\u4ee5\u5916\u7684\u610f\u4e49\u3002\u4e00\u65e6\u8d8a\u8fc7\u8fd9\u4e2a\u754c\u9650\uff0c\u5c31\u53ef\u80fd\u4ea7\u751f\u4eba\u4e3a\u4fee\u6539\u4e3b\u952e\u7684\u52a8\u673a\uff0c\u8fd9\u6837\uff0c\u8fd9\u79cd\u7cfb\u7edf\u7528\u6765\u94fe\u63a5\u8bb0\u5f55\u884c\u3001\u7ba1\u7406\u8bb0\u5f55\u884c\u7684\u5173\u952e\u624b\u6bb5\u5c31\u4f1a\u843d\u5165\u4e0d\u4e86\u89e3\u6570\u636e\u5e93\u8bbe\u8ba1\u7684\u4eba\u7684\u624b\u4e2d\u3002

$con = mysql_connect("localhost","peter","abc123"); \u8fd9\u6bb5\u662f\u8fde\u63a5\u6570\u636e\u5e93
$result = mysql_query("SELECT * FROM Persons
WHERE FirstName='Peter'");
\u8fd9\u6bb5\u67e5\u8be2\u6570\u636e\u5e93\u91cc\u8fb9\u67d0\u884c\u7684\u6570\u636e\uff0c
\u6240\u6709\u4ee3\u7801\u4e2d\u6ca1\u6709\u521b\u5efa\u6570\u636e\u5e93\u548c\u8868\u7684\u4ee3\u7801

1,下载mysql数据库 源代码 : mysql-6.0.10-alpha.tar.gz 2, 解压 文件比较多,解压也一段时间。 src]# tar vxzf mysql-6.0.10-alpha.tar.gz 3, 进入目录进行 -> 配置,编译,安装 ]# cd mysql-6.0.10-alpha 配置生成 makefile 文件 ]# ./configure --sysconfdir=/etc checking for termcap functions library... configure: error: No curses/termcap library found 出现错误,也就是生成 makefile 文件出错了。 [root@localhost mysql-6.0.10-alpha]# make make: *** No targets specified and no makefile found. Stop. 如果你硬要输入 make 命令是不行的,因为 makefile 根本没有生成成功。 解决办法: 我们加入 --with-named-curses-libs=/usr/lib/libncursesw.so.5 进行生成 makefile ./configure --sysconfdir=/etc --with-named-curses-libs=/usr/lib/libncursesw.so.5 Thank you for choosing MySQL! 看到这句话,生成 makefile 成功了。 下面进行make编译: 需要的时间比较长。 ]# make 编译安装虽然花费的时间比较长,但是它应该可以适合任何一个发行版本的 Linux,编译的中途过程我就不播放视频出来了,截断一部分。我现在已经编译完成。 make[1]: Leaving directory `/opt/mysql-6.0.10-alpha/sql-bench' Making all in win make[1]: Entering directory `/opt/mysql-6.0.10-alpha/win' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/mysql-6.0.10-alpha/win' 最后进行安装 ]# make install 编译安装完毕,有时候需要很长时间,如何判断是否死机? 注意观察主机的硬盘灯,编译安装时候 硬盘灯是一闪一闪的,有数据读取。 下面拷贝配置文件 ]# cp /usr/local/share/mysql/my-large.cnf /etc/my.cnf 以后配置mysql ,就修改 /etc/my.cnf 即可 4, 初始化数据库 # useradd -d /usr/local/var mysql # su - mysql $ /usr/local/bin/mysql_install_db 初始化出现错误。 Installing MySQL system tables... 090518 7:16:41 [ERROR] /usr/local/libexec/mysqld: unknown option '--skip-federated' 090518 7:16:41 [ERROR] Aborting 090518 7:16:41 [Note] /usr/local/libexec/mysqld: Shutdown complete 我们解决办法是,先 删掉 /usr/local/var 下的 mysql 文件夹 rm -rf /usr/local/var/mysql 然后修改 vi /etc/my.cnf 找到skip-federated 注释掉 ,也就是改成 ####skip-federated 然后保存退出 su - mysql 用会 mysql 身份, 来重新初始化 /usr/local/bin/mysql_install_db 这次成功了吧,没有出现错误信息。 5, 启动服务器 [mysql@localhost var]$ /usr/local/bin/mysqld_safe & 现在成功了, 用 netstat -tnl 看到 3306 熟悉的 mysql默认端口 6, 登陆测试 [mysql@localhost local]$ mysql -u root 成功的话, 出现 mysql> mysql>\s mysql>\q 可以使用 show databases; 一般,如果你是编译安装mysql ,建议你像我下面的做法 提升为 root 用户, su - cp /usr/local/share/mysql/mysql.server /etc/init.d/mysqld mysql 关闭的命令为:/etc/init.d/mysqld stop [root@localhost ~]# /etc/init.d/mysqld stop Shutting down MySQL.090518 07:26:41 mysqld_safe mysqld from pid file /usr/local/var/localhost.localdomain.pid ended SUCCESS! 就会显示 关闭成功。 mysql 启动的命令为:/etc/init.d/mysqld start [root@localhost ~]# /etc/init.d/mysqld start Starting MySQL. SUCCESS! 下面修改 服务器启动时候,就自动运行 mysql 6.0 vi /etc/rc.d/rc.local 我把它运行在 tomcat 前面, 然后保存退出。 ##################### 分隔 ###################### --查看数据库的字符集 show variables like 'character\_set\_%'; show variables like 'collation_%'; 13:15 浏览(587) 评论(0) 分类: CentOS 2009-07-21 缩略显示 CentOS5.3 编译 mod_jk 1.2.15 链接器 整合apache httpd 和 tomcat关键字: centos mod_jk 现在我们来做一个整合,也就是当访问 apache 80 端口时候 遇到 jsp 文件也可以正常访问。 如果不整合, 你的apache 80 是不能运行jsp文件的, 只能使用8080端口,也就是tomcat 来访问。 如何整合呢 ? 要借助一个叫做 apache tomcat 的链接器。 下面是官方网站的下载地址,目前为止最新版是 1.2.15。。。 http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.15/ 文章最后我会把这个工具提供下载,如果官方网站太慢的话。 首先下载 jakarta-tomcat-connectors-1.2.15-src.tar.gz 到服务器 解压 ]# tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz 注意是进入: jk/native 这个目录 ]# cd jakarta-tomcat-connectors-1.2.15-src/jk/native 请确认你的 apache 的 apxs 文件位置 native]# ./configure --with-apxs=/usr/local/apache2/bin/apxs 编译生成mod_jk native]# make 拷贝编译完成生成的 mod_jk.so 文件, 这里也是要注意你的apache modules 目录位置 native]# cp ./apache-2.0/mod_jk.so /usr/local/apache2/modules/ =============================================== 修改apache 配置文件 # vi /etc/httpd.conf 在DirectoryIndex中添加 index.jsp <IfModule dir_module> DirectoryIndex index.html index.jsp </IfModule> 增加关于加载mod_jk的语句: LoadModule jk_module modules/mod_jk.so Include /usr/local/apache2/conf/mod_jk.conf 添加以下内容( 添加的时候去掉注释,可能文件不能显示中文 ): ###### 指出mod_jk模块工作所需要的工作文件workers.properties的位置 JkWorkersFile /usr/local/apache2/conf/workers.properties ###### Where to put jk logs JkLogFile /usr/local/apache2/logs/mod_jk.log ###### Set the jk log level [debug/error/info] JkLogLevel info ###### Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" ###### JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories ###### JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" ###### 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理 JkMount /servlet/* worker1 JkMount /*.jsp worker1 JkMount /*.do worker1 把一些注释去掉吧,只些一些起作用的语句上去。保存退出。 =================================================== 在/usr/local/apache2/conf/ 下面 建立两个配置文件mod_jk.conf和workers.propertie 注意: ( 如果没有 conf 目录,可以建立,因为我安装时指定把 httpd.conf 放在 /etc 下的,就没有 conf 目录了 ) # vi mod_jk.conf 添加以下内容( 添加的时候去掉注释,可能文件不能显示中文 ): ###### 指出mod_jk模块工作所需要的工作文件workers.properties的位置 JkWorkersFile /usr/local/apache2/conf/workers.properties ###### Where to put jk logs JkLogFile /usr/local/apache2/logs/mod_jk.log ###### Set the jk log level [debug/error/info] JkLogLevel info ###### Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" ###### JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories ###### JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" ###### 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理 JkMount /servlet/* worker1 JkMount /*.jsp worker1 JkMount /*.do worker1 ------------------------------------------------------------ # vi workers.properties 添加以下内容: ####### Defining a worker named worker1 and of type ajp13 worker.list=worker1 ####### Set properties for worker1 worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300 ------------------- 我的tomcat 配置文件路径: /usr/local/tomcat/conf/server.xml 最后编辑Tomcat的配置文件server.xml,在 <Host 段中加入: <Context path="" docBase="/usr/local/apache2/htdocs" debug="0" reloadable="true" crossContext="true"/> 重新启动Apache和Tomcat。。。 [root@localhost bin]# ./shutdown.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.7.0 [root@localhost bin]# ./startup.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.7.0 # /usr/local/apache2/bin/apachectl stop # /usr/local/apache2/bin/apachectl start 刚才我在修改 httpd.conf 可能写入了一些多余信息 导致apache配置文件出错,我注释就可以了。 在/usr/local/apache2/htdocs/ 下 删掉 index.html 建立一个index.jsp , 写入一些简单的内容: <% out.println( "Hello www.17rumen.com " ); %> 用浏览器访问服务器 http://192.168.138.128 ,看到正确的页面了。 说明apache 遇到jsp页面 ,它可以提交给 tomcat 去处理。。。 18:21 浏览(315) 评论(0) 分类: CentOS 2009-07-21 缩略显示 centos“You don't have permission to access /index.html on this server.”关键字: centos Forbidden You don't have permission to access /index.html on this server. 开始我以为我配置出错,花半天时间都没有搞定,今天终于搞定了. 原因:index.html是用root用户建的文件,apache权限不够。 解决方法:更改文件权限;chmod 755 index.html 17:09 浏览(498) 评论(0) 分类: CentOS 2009-07-17 缩略显示 CentOS5.3 编译安装 apache 2.2.11 web服务器(httpd-2.2.11.tar.gz)关键字: centos apache (现检测是否已经安装apapche,如果有的话请卸载后重新安装) 1, 首先你必须下载 : httpd-2.2.11.tar.gz 当然你也可以到官方 http://www.apache.org 上下载。 2, 解压 src]# tar vxzf httpd-2.2.11.tar.gz 3, 进入目录 # cd httpd-2.2.11 httpd-2.2.11]# ./configure --sysconfdir=/etc --enable-ssl --enable-modules 配置文件放在 /etc 下 no SSL-C headers found configure: error: ...No recognized SSL/TLS toolkit detected 没有ssl 我们,生成makefile 文件失败,以后再安装 openssl 也可以 httpd-2.2.11]# ./configure --sysconfdir=/etc --enable-modules 好,这次没有发现什么错误, --enable-modules 这个强烈建议加上, 也就是说 以后apache 可以添加其他的模块,方便很多。 下面进行编译,make编译 需要一定的时间,不过比起编译mysql要快些。 httpd-2.2.11]# make 下面进行安装 httpd-2.2.11]# make install 安装完成了。。。 4, 启动服务 测试一下吧。 ]# /usr/local/apache2/bin/apachectl start & # netstat -tnl 可以看到 80 端口,说明apache启动了。 tcp 0 0 :::80 :::* LISTEN 打开浏览器进行访问吧。 # ifconfig 查看 Linux 服务器ip地址。 inet addr:192.168.138.128 http://192.168.138.128 看到It works! 说明正常工作了 cd /usr/local/apache2/ 可以看到 htdocs 就是 web 服务器的 目录所在 你可以想我这样 vi test.html 上面写一些信息,然后进行访问。 让Apache 自动启动 # echo "/usr/local/apache2/bin/apachectl start &" >> /etc/rc.local (或者手动在/etc/rc.d/rc.local中设置) 好,然后重启服务器,就可以发现 apache 自动启动了

扩展阅读:cn11 me ... centos7 yum ... cn3 app ... centos java ... centos 1708 ... centos 8 stream ... cn3 ... centos7 mysql ... centos linux ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网