十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
“数据库”的位置应该填,你要连接的这台服务器上的mysql数据库的库名,而不是写mysql
源城网站建设公司创新互联,源城网站设计制作,有大型网站制作公司丰富经验。已为源城上千家提供企业网站建设服务。企业网站搭建\成都外贸网站建设公司要多少钱,请找那个售后服务好的源城做网站的公司定做!
比如你的mysql数据库中有个叫test的数据库,你就填test
MYSQL的具体安装我就暂时不和题主说了,如果在安装的时候遇到什么问题的话,题主可以再询问我。至于配置的话如下:
MySQL开启后,可执行登录,进行密码的初始化:
# mysql -u root -p
首先设置出事密码:
# mysqlSET PASSWORD = PASSWORD('123456');
# mysqlexit
退出后,使用命令restart重启MySQL,使用密码123456来登录,初始命令成功。
配置MySQL的配置文件。现将/usr/share/mysql下的配置文件my-medium.cnf复制到/etc 目录下:
# cp my-medium.cnf /etc/my.cnf
编辑该文件:在文件中[mysqld]标签下添character-set-server=gbk;[client]分别添加 default-character-set=gbk;保存退出即可。
设置远程登录
由于MySQL是要被子机远程访问的,而MySQL默认的情况下是无法远程访问的,因此要进行相应的设置。先创建一个数据库实例给finebi工程调用替换finedb,并设置账号,可远程登录。
# mysqlcreate database bi_config;
# mysqlCREATE USER 'wind'@'%' IDENTIFIED BY '123456';
# mysqlflush privileges;
# mysqlgrant all on bi_config.* to 'wind'@'%';
# mysqlflush privileges;
由于MySQL要满足远程登录的需求,因此对于Linux的系统,我们要在iptables开放3306的端口,编辑命令:
# vi /etc/sysconfig/iptables
添加内容如下图:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
在客户端机上,安装client文件,可以尝试登录远程登录:
# mysql -h192.168.42.129 -uwind -p123456
登录如下图,则成功:
oracle:系统redhat 5.5 数据库:11.2.0.1
mysql:系统centos6.3 数据库:5.6.21
1.先装 mysql-connector-odbc和unixODBC
[root@rac1 ~]# rpm -qa | grep mysql
mysql-5.0.77-4.el5_4.2
mysql-5.0.77-4.el5_4.2
mysql-connector-odbc-5.1.13-1.rhel5
[root@rac1 ~]# rpm -qa | grep ODBC
unixODBC-devel-2.2.11-7.1
unixODBC-2.2.11-7.1
unixODBC-devel-2.2.11-7.1
unixODBC-2.2.11-7.1
2.配置 /etc/odbc.ini
[myodbc3]
Driver = /usr/lib64/libmyodbc5.so
Description = MySQL ODBC 5.1 Driver DSN
SERVER = 192.1.1.200
PORT = 3306
USER = bi
Password = 123456
Database = chanpin
OPTION = 3
SOCKET =
charset = utf8
3.配置/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib64/libmyodbc5.so
Setup = /usr/lib64/libodbcmyS.so
FileUsage = 1
4.测试连接
[root@rac1 ~]# isql myodbc3 -v
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL
5.配置oracle环境变量
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/grid
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=rac1
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$BASE_PATH:/usr/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib:$ORACLE_HOME/hs/lib:/usr/lib64
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
ODBCINI=/etc/odbc.ini; export ODBCINI
ODBCSYSINI=/etc; export ODBCSYSINI
ODBCINSTINI=/etc/odbc.ini
export ODBCINSTINI
6.配置监听
listener.ora:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.1.1.100)(PORT = 1522))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(PROGRAM = dg4odbc)
(SID_NAME= myodbc3)
(ORACLE_HOME= /u01/app/oracle/product/11.2.0/db_1)
(ENVS=LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/db_1/lib:/lib:/usr/lib:/usr/local/lib:/u01/app/oracle/product/11.2.0/db_1/hs/lib:/usr/lib64)
)
)
tnsname.ora:
myodbc3=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.1.1.100)(PORT = 1522))
(CONNECT_DATA =
(SID = myodbc3))
(HS = OK)
)
7.配置odbc监听
路径:$ORACLE_HOME/hs/admin
注意:名字要跟odbc配置的名字一样 我这里是myodbc3
[oracle@rac1 admin]$ cat initmyodbc3.ora
HS_FDS_CONNECT_INFO = myodbc3
HS_FDS_TRACE_LEVEL = ON
HS_FDS_TRACE_FILE_NAME = odbc_test.log
HS_FDS_TRACE_LEVEL = 4
HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so
HS_FDS_SUPPORT_STATISCTICS = FALSE
HS_LANGUAGE = AMERICAN_AMERICA.WE8ISO8859P1
HS_FDS_SQLLEN_INTERPRETATION=32
set ODBCINI = /etc/odbc.ini
8.测试下监听
[oracle@rac1 admin]$ tnsping myodbc3
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 25-NOV-2014 03:02:16
Copyright (c) 1997, 2009, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.1.1.100)(PORT = 1522)) (CONNECT_DATA = (SID = myodbc3)) (HS = OK))
OK (0 msec)
9.创建dblink
SQLcreate public database link myodbc connect to "bi" identified by "123456" using'myodbc3';
SQL select count(*) from "t_user"@myodbc;
COUNT(*)
----------
53980