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.
相关文档:
GRANT ALL PRIVILEGES
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
Sql代码 复制代码
1. mysql -u root -pvmwaremysql>use mysql;
  ......
由于项目需要,对mysql分布事务有一定要求.这里先简单说明必要.
假设,日常财务中,要完成一个拥护订购,必须将定单操作和财务操作封在一个事务中才能保证交易完整性.
如果定单和财务数据都分布在各自的实例中,则必须用分布事务才能满足.
废话不多,进入分布事务探索。
(本文例子来自网络,本文只注重探索)
1.在本机 loca ......
http://linux.chinaitlab.com/MYSQL/524755_2.html
http://bbs.chinaunix.net/archiver/?tid-809159.html
在Apache, PHP,
MySQL的体系架构中,MySQL对于性能的影响最大,也是关键的核心部分。对于Discuz!论坛程序也是如此,MySQL的设置是否合理优化,直接
影响到论坛的速度和承载量!同时,MySQL也是优化难度最大 ......
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 ......
Mysql 中定义字段后的数据的用处:
int(1)和int(10)似乎没有什么差别,都表示最大四个字节的整型数据。
例如定义一个名字为test的表:
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`id` int(1) NOT NULL,
`ids` int(10) default NULL,
`c` char(1) default NULL,
`cs` ......