网站建设资讯

NEWS

网站建设资讯

虚拟机下安装和配置mysql的过程

本篇内容介绍了“虚拟机下安装和配置MySQL的过程”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

在隆阳等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站制作、成都网站建设 网站设计制作按需定制设计,公司网站建设,企业网站建设,高端网站设计,成都全网营销推广,成都外贸网站建设,隆阳网站建设费用合理。

首先,安装MySQL。

[root@sample ~]#yum -y install mysql-server ← 安装MySQL

Setting up Install Process
Setting up repositories
dag 100% |=========================| 1.1 kB 00:00
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 106 kB 00:00
update : ################################################## 261/261
Added 5 new packages, deleted 0 old in 2.02 seconds
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for mysql-server to pack into transaction set.
mysql-server-4.1.20-1.RHE 100% |=========================| 29 kB 00:00
---> Package mysql-server.i386 0:4.1.20-1.RHEL4.1 set to be updated
--> Running transaction check
--> Processing Dependency: libmysqlclient.so.14(libmysqlclient_14) for package: mysql-server
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server
--> Processing Dependency: perl-DBI for package: mysql-server
--> Processing Dependency: perl(DBI) for package: mysql-server
--> Processing Dependency: mysql = 4.1.20-1.RHEL4.1 for package: mysql-server
--> Processing Dependency: libmysqlclient.so.14 for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.14(libmysqlclient_14) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.14 for package: mysql-server
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-DBD-MySQL to pack into transaction set.
perl-DBD-MySQL-2.9004-3.1 100% |=========================| 5.4 kB 00:00
---> Package perl-DBD-MySQL.i386 0:2.9004-3.1 set to be updated
---> Downloading header for mysql to pack into transaction set.
mysql-4.1.20-1.RHEL4.1.i3 100% |=========================| 35 kB 00:00
---> Package mysql.i386 0:4.1.20-1.RHEL4.1 set to be updated
---> Downloading header for perl-DBI to pack into transaction set.
perl-DBI-1.40-8.i386.rpm 100% |=========================| 11 kB 00:00
---> Package perl-DBI.i386 0:1.40-8 set to be updated
--> Running transaction check Dependencies Resolved=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mysql-server i386 4.1.20-1.RHEL4.1 update 9.8 M
Installing for dependencies:
mysql i386 4.1.20-1.RHEL4.1 update 2.9 M
perl-DBD-MySQL i386 2.9004-3.1 base 111 k
perl-DBI i386 1.40-8 base 466 kTransaction Summary
=============================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 13 M
Downloading Packages:
(1/4): perl-DBD-MySQL-2.9 100% |=========================| 111 kB 00:00
(2/4): mysql-server-4.1.2 100% |=========================| 9.8 MB 00:11
(3/4): mysql-4.1.20-1.RHE 100% |=========================| 2.9 MB 00:03
(4/4): perl-DBI-1.40-8.i3 100% |=========================| 466 kB 00:01
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-DBI ######################### [1/4]
Installing: mysql ######################### [2/4]
Installing: perl-DBD-MySQL ######################### [3/4]
Installing: mysql-server ######################### [4/4]Installed: mysql-server.i386 0:4.1.20-1.RHEL4.1
Dependency Installed: mysql.i386 0:4.1.20-1.RHEL4.1 perl-DBD-MySQL.i386 0:2.9004-3.1 perl-DBI.i386 0:1.40-8
Complete!


然后,安装PHP访问MySQL数据库的工具“php-mysql”。

[root@sample ~]#yum -y install php-mysql ← 安装php-mysql

Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php-mysql to pack into transaction set.
php-mysql-4.3.9-3.15.i386 100% |=========================| 18 kB 00:00
---> Package php-mysql.i386 0:4.3.9-3.15 set to be updated
--> Running transaction check Dependencies Resolved=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
php-mysql i386 4.3.9-3.15 update 35 kTransaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 35 k
Downloading Packages:
(1/1): php-mysql-4.3.9-3. 100% |=========================| 35 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php-mysql ######################### [1/1]Installed: php-mysql.i386 0:4.3.9-3.15
Complete!

 我在自己安装过程中,上边的步骤都省略了,直接从下边开始的。 

配置MySQL


然后,配置MySQL。

[root@sample ~]#vi /etc/my.cnf ← 编辑MySQL的配置文件

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1 ← 找到这一行,在这一行的下面添加新的规则,让MySQL的默认编码为UTF-8
default-character-set = utf8 ← 添加这一行

然后在配置文件的文尾填加如下语句:

[mysql]
default-character-set = utf8

 2008-1-14在导入数据的时候,发现utf8字符集不能导入汉字,最后将utf8改成gbk问题解决但是在2008-1-16日,实际部署应用程序的时候,发现gbk依然不行,就又改成gb2312,然后重新导入数据库 

启动MySQL服务


启动MySQL,并让MySQL在系统重新启动后随系统自动启动。

[root@sample ~]# chkconfig mysqld on ← 设置MySQL服务随系统启动自启动

[root@sample ~]#

chkconfig --list mysqld ← 确认MySQL自启动
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 如果2--5为on的状态就OK

[root@sample ~]#

/etc/rc.d/init.d/mysqld start ← 启动MySQL服务

Initializing MySQL database:         [ OK ]
Starting MySQL:              [ OK ]
MySQL初始环境设定


[1]为MySQL的root用户设置密码

MySQL在刚刚被安装的时候,它的root用户是没有被设置密码的。首先来设置MySQL的root密码。

[root@sample ~]#mysql -u root ← 用root用户登录MySQL服务器

Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 2 to server version: 4.1.20 Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql>select user,host,password from mysql.user; ← 查看用户信息
+------+------------------------------+---------------+
| user | host          | password |
+------+------------------------------+---------------+
| root | localhost       |       | ← root密码为空
| root | sample.centospub.com  |       | ← root密码为空
|   | sample.centospub.com |       |
|   | localhost       |       |
+------+------------------------------+---------------+
4 rows in set (0.00 sec)mysql>set password for root@localhost=password('在这里填入root密码'); ← 设置root密码
Query OK, 0 rows affected (0.01 sec)mysql>set password for root@'sample.centospub.com'=password('在这里填入root密码'); ← 设置root密码
Query OK, 0 rows affected (0.01 sec)mysql>select user,host,password from mysql.user; ← 查看用户信息
+------+--------------------------------+--------------------------+
| user | host          | password    |
+------+--------------------------------+--------------------------+
| root | localhost        | 19b68057189b027f | ← root密码被设置
| root | sample.centospub.com   | 19b68057189b027f | ← root密码被设置
|    | sample.centospub.com   |          |
|    | localhost        |          |
+------+--------------------------------+--------------------------+
4 rows in set (0.01 sec)mysql>exit ← 退出MySQL服务器
Bye


然后,测试一下root密码有没有生效。

[root@sample ~]# mysql -u root ← 通过空密码用root登录

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

 ← 出现此错误信息说明密码设置成功

[root@localhost ~]#

mysql -u root -h sample.centospub.com  ← 通过空密码用root登录

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

 ← 出现此错误信息说明密码设置成功

[root@sample ~]#

mysql -u root -p ← 通过密码用root登录
Enter password: ← 在这里输入密码

Welcome to the MySQL monitor. Commands end with ; or /g.

 ← 确认用密码能够成功登录
Your MySQL connection id is 5 to server version: 4.1.20 Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> exit
Bye

[root@sample ~]#

mysql -u root -h sample.centospub.com -p ← 通过密码用root登录
Enter password: ← 在这里输入密码

Welcome to the MySQL monitor. Commands end with ; or /g.

 ← 确认用密码能够成功登录
Your MySQL connection id is 6 to server version: 4.1.20Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> exit ← 退出MySQL服务器
Bye


[2] 删除匿名用户

在MySQL刚刚被安装后,存在用户名、密码为空的用户。这使得数据库服务器有无需密码被登录的可能性。为消除隐患,将匿名用户删除。

[root@sample ~]# mysql -u root -p ← 通过密码用root登录
Enter password: ← 在这里输入密码

Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 7 to server version: 4.1.20

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> select user,host from mysql.user; ← 查看用户信息
+------+----------------------------+
| user | host         |
+------+----------------------------+
|   | localhost       |
| root | localhost       |
|   | sample.centospub.com |
| root | sample.centospub.com  |
+------+----------------------------+
4 rows in set (0.02 sec)mysql> delete from mysql.user where user=''; ← 删除匿名用户
Query OK, 2 rows affected (0.17 sec)mysql> select user,host from mysql.user; ← 查看用户信息
+------+----------------------------+
| user | host         |
+------+----------------------------+
| root | localhost      |
| root | sample.centospub.com |
+------+----------------------------+
2 rows in set (0.00 sec)mysql> exit ← 退出MySQL服务器
Bye


[3] 删除测试用数据库

在MySQL被安装后,存在名为test的空数据库,将它删除。这里要注意的是,系统默认的还有一个名为mysql的数据库,它用于系统管理,所以请不要删除。

[root@sample ~]# mysql -u root -p ← 通过密码用root登录
Enter password: ← 在这里输入密码
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 8 to server version: 4.1.20 Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> show databases;  ← 查看系统已存在的数据库
+-------------+
| Database |
+-------------+
| mysql   |
| test   |
+------------+
2 rows in set (0.02 sec)mysql> drop database test; ← 删除名为test的空数据库
Query OK, 0 rows affected (0.07 sec)mysql> show databases; ← 查看系统已存在的数据库
+-------------+
| Database |
+-------------+
| mysql   | ← 确认名为test的数据库被删除,已不存在
+-------------+
1 row in set (0.00 sec)mysql> exit  ← 退出MySQL服务器
Bye
测试MySQL


下面对MySQL进行测试。包括建立新用户,以及用对关系性数据库进行数据库操作的指令来试着建立数据库及数据表。这里,新建用户以centospub为例。

[root@sample ~]# mysql -u root -p ← 通过密码用root登录
Enter password: ← 在这里输入密码

Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 9 to server version: 4.1.20

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> grant all privileges on test.* to centospub@localhost identified by '在这里定义密码'; ← 建立对test数据库有完全操作权限的名为centospub的用户
Query OK, 0 rows affected (0.03 sec)mysql> select user from mysql.user where user='centospub'; ← 确认centospub用户的存在与否
+---------+
| user  |
+---------+
| centospub | ← 确认centospub已经被建立
+---------+
1 row in set (0.01 sec)mysql> exit ← 退出MySQL服务器
Bye

[root@sample ~]#

mysql -u centospub -p ← 用新建立的centospub用户登录MySQL服务器
Enter password: ← 在这里输入密码

Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 10 to server version: 4.1.20

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> create database test; ← 建立名为test的数据库
Query OK, 1 row affected (0.00 sec)mysql> show databases; ← 查看系统已存在的数据库
+-------------+
| Database |
+-------------+
| test    |
+-------------+
1 row in set (0.00 sec)mysql> use test ← 连接到数据库
Database changed

mysql>

create table test(num int, name varchar(50)); ← 在数据库中建立表
Query OK, 0 rows affected (0.03 sec)mysql> show tables; ← 查看数据库中已存在的表
+-------------------+
| Tables_in_test |
+-------------------+
| test     |
+-------------------+
1 row in set (0.01 sec)mysql> insert into test values(1,'Hello World!'); ← 插入一个值到表中
Query OK, 1 row affected (0.02 sec)mysql> select * from test; ← 查看数据库中的表的信息
+------+-------------------+
| num | name      |
+------+-------------------+
| 1   | Hello World!  |
+------+-------------------+
1 row in set (0.00 sec)mysql> update test set name='Hello Everyone!'; ← 更新表的信息,赋予新的值
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> select * from test; ← 查看数据库中的表的信息
+------+----------------------+
| num | name      |
+------+----------------------+
| 1   | Hello Everyone! | ← 确认被更新到新的值
+------+----------------------+
1 row in set (0.01 sec)mysql> delete from test where num=1; ← 删除表内的值
Query OK, 1 row affected (0.00 sec)mysql> select * from test; ← 确认删除结果
Empty set (0.01 sec)mysql> drop table test; ← 删除表
Query OK, 0 rows affected (0.01 sec)mysql> show tables; ← 查看表信息
Empty set (0.00 sec) ← 确认表已被删除mysql> drop database test; ← 删除名为test的数据库
Query OK, 0 rows affected (0.01 sec)mysql> show databases; ← 查看已存在的数据库
Empty set (0.01 sec) ← 确认test数据库已被删除(这里非root用户的关系,看不到名为mysql的数据库)mysql>exit ← 退出MySQL服务器
Bye

     然后,删除测试用过的遗留用户。

[root@sample ~]# mysql -u root -p ← 通过密码用root登录
Enter password: ← 在这里输入密码

Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 12 to server version: 4.1.20 Type 'help;' or '/h' for help. Type '/c' to clear the buffer.mysql> revoke all privileges on *.* from centospub@localhost; ← 取消centospub用户对数据库的操作权限
Query OK, 0 rows affected (0.00 sec)mysql> delete from mysql.user where user='centospub' and host='localhost'; ← 删除centospub用户
Query OK, 1 row affected (0.01 sec)mysql> select user from mysql.user where user='centospub'; ← 查找用户centospub,确认已删除与否
Empty set (0.01 sec) ← 确认centospub用户已不存在mysql> flush privileges; ← 刷新,使以上操作生效
Query OK, 0 rows affected (0.01 sec)mysql>exit
Bye


最后,重新启动一次HTTP服务,让php-mysql反映到HTTP服务中。

[root@sample ~]# /etc/rc.d/init.d/httpd restart ← 重新启动HTTP服务
Stopping httpd:             [ OK ]
Starting httpd:             [ OK ]

    执行sql语句文件的方式方法: #mysql -uroot –p123456 < /tmp/mydata.sql 查看mysql的版本:select version();grant all privileges on *.* to usr@localhost identified by '123456';    MySQL客户端不能连接解决办法放开3306端口:/sbin/iptables   -A INPUT  -i eth0 -p  tcp  --dport 3306   -j       ACCEPT      
/sbin/iptables   -A INPUT  -i eth0 -p  udp  --dport 3306   -j       ACCEPT      给用户授权:

mysql>grantallprivilegeson*.*to'yourname'@'%' identified by'youpasswd';
Query OK, 0 rows affected (0.05 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

关键是flush privileges; 奶奶的,解决   安装ssh因为没有安装telnet和ftp服务,因此不得不安装另外的远程操作软件,分别是Secure CRT和Secure FX。这个安装也没什么大事,只是需要破解而已   Linux基础Linux的很多命令类似于unix,但又有很多不同1、 查看磁盘空间:df2、 网卡配置, vi /etc/sysconfig/network-scripts/ifcfg-eth0 配置完毕重启网络命令:/etc/rc.d/init.d/network restart3、 压缩命令 tar –cvfz /tmp/etc.tar.gz /etc/* 把etc下边的压缩到 /tmp下 解压     tar –xvfz *.gz4、 重启 reboot5、 mount /dev/cdrom 自动挂载光驱到 /media/cdrecorder 这个目录是自动创建的卸载光驱的时候注意要退出 /media/cdrecorder这个目录,否则提示device busy  安装java下载的java文件名字是j2sdk-1_4_2_16-linux-i586-rpm.bin 先更改文件属性,可执行,chmod a+x j2sdk-1_4_2_16-linux-i586-rpm.bin 执行方式是:#./j2sdk-1_4_2_16-linux-i586-rpm.bin –mode=console 执行结果为生成一个j2sdk-1_4_2_16-linux-i586-rpm文件 然后再执行:#rpm –ivh j2sdk-1_4_2_16-linux-i586-rpm 一般被安装在 /usr/java/j2sdk1.4.2_16下 然后设置/etc/profile    主要增加如下几句 # Path manipulation JAVA_HOME=/usr/java/j2sdk1.4.2_16 CLASSPATH=/usr/java/j2sdk1.4.2_16/lib/dt.jar:/usr/java/j2sdk1.4.2_16/lib/tools.jar:/usr/java/j2sdk1.4.2_16/lib:/usr/java/j2sdk1.4.2_16:.:/usr/java/j2sdk1.4.2_16/bin PATH=$PATH:$HOME/bin:.:/usr/java/j2sdk1.4.2_16  

    安装weblogic开始直接用以前的一个linux下的版本,安装失败,具体原因不详,大概是版本的问题。 ./server816_linux32.bin 一、图形界面安装如果linux装了图形界面,则可以在图形界面下安装,直接运行./server816_linux32.bin,然后进行weblogic的derver创建。 最后定义用户名为weblogic,密码也是weblogic。二、字符界面安装如果没有图形界面,则执行./server816_linux32.bin –mode=console,字符界面安装,根据提示安装就可以了,过程参考如下:a.简单介绍。选择next.
     b.文件extract完以后,开始安装,首先,阅读一个license agreement,
       选择1,同意开始安装 2。不同意
     c.选择bea产品目录,选择默认选项,next。
     d.选择安装类型,选择全部安装,next。  
     e.选择weblogic的安装目录,选择默认项,next.
     f.开始安装文件。三、配置web服务器域以及web服务器进入<你的weblogic安装目录>/weblogic81/common/bin命令行模式启动配置:./config.sh –mode=consolea.弹出画面,选择Create a new WebLogic configuration。继续b.选择Basic WebLogic Server Domain 8.1.5.0继续。c.出现Do you want to run the wizard in express mode?选择no,继续。d.选择Configure the Administration Server,你可以配置服务器名,监听端口。e.Do you want to configure Managed Servers, Clusters and Machines,选择no,继续。f.Do you want to configure JDBC (Java Database Connectivity)?选择no,继续。g.Do you want to configure JMS (Java Messaging Service)?选择no,继续。h.Do you want to configure Advanced Security?选择no,继续。i.是否修改其默认的用户名称,口令,修改完毕后继续j.Domain Mode Configuration,选择开发模式,继续k.Java SDK Selection,可以选择3,然后将安装的jdk全路径写入,继续m.Select the target domain directory,你可以指定安装domain的目录路径。n.Edit Domain Information,可以修改domain的信息,继续。四、破解weblogic用户限制  安装完毕后,这是个没有破解的版本,只支持5个用户,所以需要破解,将以前的破解文件拷贝到相应的目录就可以完成了。  五、验证码问题在实际应用中,验证码不能显示 原因主要是java默认时候用windows的图形包,所以在linux会有这种情况,如果可以用x 界面的话,就有图形包了直接在linux图形界面下启动没有问题,但是如果用其他终端远程启动就有问题,最后找到办法,修改startWebLogic.sh,蓝色部分为增加的内容if [ "${WLS_REDIRECT_LOG}" = "" ] ; then        echo "Starting WLS with line:"        echo "${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${PROXY_SETTINGS} ${SERVER_CLASS}"        ${JAVA_HOME}/bin/java ${JAVA_VM} -Djava.awt.headless=true -Dfile.encoding=GBK ${MEM_ARGS} ${JAVA_OPTIONS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${PROXY_SETTINGS} ${SERVER_CLASS} else        echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"        ${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${PROXY_SETTINGS} ${SERVER_CLASS} > "${WLS_REDIRECT_LOG}" 2>&1 fi 方法-Djava.awt.headless=true的原理应该和PJA相同,就是说JDK 1.4中包含了类似PJA的一些API,java.awt.headless参数就是开关,负责在这些API和操作系统的API之间选择,-Djava.awt.headless=true就选择JDK 1.4中的API,不再调用操作系统的API。   在weblogic816版本中,这段文字也能找到,就是比较的麻烦,大概在173行 其中-Dfile.encoding=GBK是为了应用程序中文显示问题六、启动停止weblogic启动:startWebLogic.sh 停止:stopWebLogic.sh当然也可以通过ps -ef|grep java 来得到WebLogic的java进程号,
然后使用kill -9 pid的方式来强制停止WebLogic。卸载:/bea/weblogic81/uninstall七、配置MYSQL的JDBC1、将mysql的jdbc文件mysql-connector-java-5.0.4-bin.jar拷贝到/bea/weblogic81/server/lib下,原来的 一些版本需要修改startWebLogic.sh,在classpath加上${WL_HOME}/server/lib/mysql-connector-java-5.0.4-bin.jar就可以完成加载jdbc的工作。 但是Weblogic每个版本classpath的位置似乎也不一样,8.1.6的classpath在/bea/weblogic/user_projects/domains/mydomain/setDomainEnv.sh中,找到这么一句,加上CLASSPATH="${ARDIR}/ant/ant.jar${CLASSPATHSEP}${JAVA_HOME}/jre/lib/rt.jar:${WLS_HOME}/ lib/mysql-connector-java-5.0.4-bin.jar",为了找这个文件,先分析了startWebLogic.sh才知道应该找setDomainEnv.sh,配置JDBC费了两三天的时间,真是有种柳暗花明的感觉!   部署应用这个过程 就不详细写了,每个人的情况都不一样,只说几个碰到的问题。   Linux系统字符集不是中文,loacle –a 查看系统字符集,已经有中文字符集,然后修该/etc/profile,最后加上export LANG=zh_CN.GB2312解决中文显示问题 是mysql区分大小写,注意跟程序一致就可以了。 关于mysql大小写的问题,下边是转帖的,感觉很不错,供大家参考:    MYSQL在默认的情况下查询是不区分大小写的,例如:

mysql> create table t1(
    -> name varchar(10));
Query OK, 0 rows affected (0.09 sec)

mysql> insert into t1 values('you'),('You'),('YOU');
Query OK, 3 rows affected (0.05 sec)
Records: 3  Duplicates: 0  Warnings: 0

对这个表,缺省情况下,下面两个查询的结果是一样的:

 mysql> select * from t1 where name = 'you';
+------+
| name |
+------+
| you  |
| You  |
| YOU  |
+------+
3 rows in set (0.00 sec)

mysql> select * from t1 where name = 'YOU';
+------+
| name |
+------+
| you  |
| You  |
| YOU  |
+------+
3 rows in set (0.00 sec)

如果想让MYSQL知道你输入的字母是大写还是小写的,修改表:

mysql> alter table t1 change name name varchar(10) binary;
Query OK, 3 rows affected (0.20 sec)
Records: 3  Duplicates: 0  Warnings: 0 mysql> select * from t1 where name = 'you';
+------+
| name |
+------+
| you  |
+------+
1 row in set (0.00 sec)

mysql> select * from t1 where name = 'YOU';
+------+
| name |
+------+
| YOU  |
+------+
1 row in set (0.00 sec)

如果你只是想在SQL语句中实现的话:

mysql> select * from t1 where name = binary 'YOU';
+------+
| name |
+------+
| YOU  |
+------+
1 row in set (0.02 sec)

mysql> select * from t1 where name = binary 'you';
+------+
| name |
+------+
| you  |
+------+
1 row in set (0.00 sec)

 

如果不想这么麻烦而想服务一开启就让大小写一致的话:
可以修改my.ini或者my.cnf
[mysqld]
 lower_case_table_names=1
(0:区分;1:不区分)
然后重启MYSQL服务。

mysql> show variables like '%case_table%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_table_names | 1     |
+------------------------+-------+
1 row in set (0.00 sec)

注:WINDOWS系统不用修改,系统默认就是1
LINUX 系统默认是0。因为LINUX下的脚本都是区分大小写的。

“虚拟机下安装和配置mysql的过程”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


新闻名称:虚拟机下安装和配置mysql的过程
链接分享:http://cdweb.net/article/jdgcog.html