Penrose连接Mysql解决方案
最近一直在进行Penrose连接Mysql的尝试,可总是提示无法连接到Mysql,无论是检查端口是否开启,设置Mysql远程访问权限等都不管用,后来在Penrose的官网找到一个建立样例数据库及设置远程连接的文档,没想到一举成功,痛快啊!
下面就把文档和大家共享一下!(是英文,大家就凑合着看下吧!因为最近搞Penrose太累了,懒的再去翻译了!)
我安装的Penrose版本是2.0的,Mysql是5.0
The following are the instructions to setup the sample database. The instructions were written for MySQL 4.x, but you can use other database systems.
Create Database
Make sure you have a MySQL server running on your local machine. Create a MySQL database called "penrose_demo". Exececute the following commands inside a MySQL client:
create database penrose_demo;
Create Database User
Create a MySQL user called "penrose" with password "penrose". Exececute the following commands inside a MySQL client:
grant all privileges on *.* to 'penrose'@'<hostname>' identified by 'penrose' with grant option;
grant all privileges on *.* to 'penrose'@'localhost' identified by 'penrose' with grant option;
grant all privileges on *.* to 'penrose'@'%' identified by 'penrose' with grant option;
注:主要是这边关于权限的设置导致我总是连接不成功!有高手能详细解释下不?
Change the <hostname> with your machine name.
Create Database Tables
Populate the database with the SQL script provided in PENROSE_HOME/samples/sql. Exececute the following commands inside a MySQL client:
use penrose_demo;
source PENROSE_HOME/samples/sql/example.sql;
注:此脚本在相应目录中没有,需自己准备sql脚本!可在mysql官网上下载到!
The script was written for MySQL 4.x. If you are using a different database system, you might need to modify the script.
相关文档:
安装mysql
sudo apt-get install mysql-server#直接自动获得可用版本
也可以这样写
sudo apt-geti nstall mysql-server-5.0#安装mysql服务器5.0版本
安装后
/etc/init.d/mysqlstart(stop)为启动和停止服务器
/etc/mysql/主要配置文件所在位置my.cnf
/var/lib/mysql/放置的是数据库表文件夹,这里的mysql相当于 ......
TomCat6.0数据库连接池配置实例(mysql数据库)
TomCat6.0数据库连接池配置有几种方式,在这里我只介绍其中的一种供大家参考:
下面我把配置过程分成三个步骤来完成:
第一步:在你安装TomCat的目录下找到context.xml配置文件。(例如:D:\Tomcat 6.0\conf\context.xml)然后打开context.xml,在标签<context>< ......
取mysql表和字段注释的语句
1、取字段注释
Select COLUMN_NAME 列名, DATA_TYPE 字段类型, COLUMN_COMMENT 字段注释
from INFORMATION_SCHEMA.COLUMNS
Where table_name = 'companies'##表名
AND table_schema = 'testhuicard'##数据库名
AND column_name LIKE 'c_name'##字段名
2、取得表注释
Select tab ......
mysql 截取某一个时间(datetime类型)的日期:
方法1:select date(row_name) from table_name where row = row1;
方法2:select left(row_name, 10) from table_name where row = row1;
方法3:select cast(row_name as char[10]) from table_name where row = row1;
取得某个日期的time_t数值:select unix_times ......
前一篇文章中说到了LOAD命令,这里就来详细的给自己,顺便也给大家讲解下LOAD命令和批处理的数据导入功能。用的时候感觉MySQL用起来真的比较滋润。。。。
批处理导入文件,从sql文件导入数据到数据库中 ,批处理是一种非交互式运行mysql程序的方法, ......