如何将Liferay与Mysql数据库连接起来

时间:2012-11-25 02:22:55

标签: database liferay

我是Liferay的新人。我想将Liferay与MySQL数据库连接起来。我正在使用Liferay CE(版本? - 与tomcat捆绑(6.0.29))。请告诉我这个步骤。谢谢

4 个答案:

答案 0 :(得分:8)

要构建已经提到的内容,请编辑liferay-portal-xxx / tomcat-xxx / webapps / ROOT / WEB-INF / classes中的文件portal-ext.properties(如果它已经不存在)然后创建它。)

将以下行添加到其中:

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=<insert your mysql username>
jdbc.default.password=<insert your mysql password>

也可能值得在mysql中创建lportal表。

mysql -u root -p <<< "create database lportal character set utf8;"

下载并解压缩此处找到的Liferay database scripts。然后运行一个,例如

mysql -u root -p < /path-to-the-script/create-mysql.sql

可以在此Liferay Ubuntu Installation Guide中找到更多信息(对于版本而言是厌倦的,但数据库部分很有用)和此Liferay Database Configuration Guide

答案 1 :(得分:2)

将以下代码行粘贴到portal-ext.properties中:

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=
jdbc.default.password=

答案 2 :(得分:0)

  1. 下载Liferay CE
  2. 安装MySQL并创建数据库
  3. 解压缩liferay并创建文件,如果没有portal.properties存在于liferay_home / tomcat-6.0.29 / webapps / ROOT / WEB-INF / clases
  4. 粘贴:
  5. jdbc.default.driverClassName = com.mysql.jdbc.Driver

    jdbc.default.url = JDBC:MySQL的://本地主机/ nameDatabase了useUnicode =真安培;的characterEncoding = UTF-8和; useFastDateParsing =假

    jdbc.default.username =名称

    jdbc.default.password =密码

    运行onm Eclipse或Windows .bat / Linux .sh 我希望能为你效力

答案 3 :(得分:0)

    1)path--->home/karthik/Desktop/LiferaySetup/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes---->create an empty doc with name as portal-ext.properties
    paste the below code:
    jdbc.default.driverClassName=com.mysql.jdbc.Driver
    jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
    jdbc.default.username=root
    jdbc.default.password=root
    2)path--->/home/karthik/Desktop/LiferaySetup/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/conf/Catalina/localhost-->Enter the below code inside ROOT.xml
     <Context path="" crossContext="true">

        <!-- JAAS -->

        <!--<Realm
            className="org.apache.catalina.realm.JAASRealm"
            appName="PortalRealm"
            userClassNames="com.liferay.portal.kernel.security.jaas.PortalPrincipal"
            roleClassNames="com.liferay.portal.kernel.security.jaas.PortalRole"
        />-->

        <!--
        Uncomment the following to disable persistent sessions across reboots.
        -->

        <!--<Manager pathname="" />-->

        <!--
        Uncomment the following to not use sessions. See the property
        "session.disabled" in portal.properties.
        -->

        <!--<Manager className="com.liferay.support.tomcat.session.SessionLessManagerBase" />-->
    <Resource
        name="jdbc/LiferayPool"
        auth="Container"
        type="javax.sql.DataSource"
        driverClassName="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8"
        username="root"
        password="root"
        maxActive="20"
    />

    </Context>
If you follow the above 2 statements you can create easily