1. mysql的编译安装
2. 在tomcat上部署有连接db的应用.并成功连接数据库.
自己正在学习大学时候没有选的课j2ee,当时为什么不选呢?
第一部分.mysql编译安装.
在以前个人比较推荐rpm包或者yum安装,一般来讲这样的安装结果总不会太糟糕,当然也不是最符合你需要的安装方法,开源的的最大魅力在于你的掌控力跟你的能力成正比,菜鸟当然只能慢慢探索,很明显我是菜鸟.只能一点一点的来,写的东西都断断续续的.分成好几份.
mysql编译安装链接: http://dev.mysql.com/doc/refman/5.1/zh/installing.html#linux-rpm
-
[root@doita ~]#useradd -u 505 -g mysql mysql
-
[root@doita mysql-5.1.60]#./configure --prefix=/opt/mysql-5.1.60 --with-plugins=all
-
为了让mysql支持innodb.喝一口凉开水.
-
出现错误
-
checking for tgetent in -ltermcap... no
-
checking for tgetent in -ltinfo... no
- checking for termcap functions library... configure: error: No curses/termcap library found
原因:
缺少ncurses安装包
解决办法:
下载安装相应软件包
一、如果你的系统是RedHat系列:
yum list|grep ncurses
yum -y install ncurses-devel
yum install ncurses-devel
二、如果你的系统是Ubuntu或Debian:
apt-cache search ncurses
apt-get install libncurses5-dev
解决以上依赖问题之后,继续安装
make install
继续进行配置,
在解压好的源码包里面,将support-files/my-medium.cnf 拷贝到 /etc/my.cnf ,里面有large ,medium,和small 三种配置组合,genjuserver性能量力而为.
拷贝 support-files/mysql.server 为 /etc/init.d/mysqld
在mysql的源码包中,运行scripts/mysql_install_db ,对数据库进行初始化.(据官方文档,应该执行安装后目录的bin/mysql_install_db,二者是一样的)
- [root@doita scripts]#./mysql_install_db
-
Installing MySQL system tables...
-
111206 20:40:46 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
-
OK
-
Filling help tables...
-
111206 20:40:46 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
-
OK
-
-
To start mysqld at boot time you have to copy
-
support-files/mysql.server to the right place for your system
-
-
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
-
To do so, start the server, then issue the following commands:
-
-
/opt/mysql-5.1.60/bin/mysqladmin -u root password 'new-password'
-
/opt/mysql-5.1.60/bin/mysqladmin -u root -h doita password 'new-password'
-
-
Alternatively you can run:
-
/opt/mysql-5.1.60/bin/mysql_secure_installation
-
-
which will also give you the option of removing the test
-
databases and anonymous user created by default. This is
-
strongly recommended for production servers.
-
-
See the manual for more instructions.
-
-
You can start the MySQL daemon with:
-
cd /opt/mysql-5.1.60 ; /opt/mysql-5.1.60/bin/mysqld_safe &
-
-
You can test the MySQL daemon with mysql-test-run.pl
-
cd /opt/mysql-5.1.60/mysql-test ; perl mysql-test-run.pl
-
- Please report any problems with the /opt/mysql-5.1.60/bin/mysqlbug
修改安装目录权限,如下
[root@doita mysql-5.1.60]#ls -ltr
total 32
drwxr-x--- 3 root mysql 4096 Dec 6 06:47 include
drwxr-x--- 3 root mysql 4096 Dec 6 06:47 lib
drwxr-x--- 2 root mysql 4096 Dec 6 06:48 bin
drwxr-x--- 10 root mysql 4096 Dec 6 06:49 mysql-test
drwxr-x--- 6 root mysql 4096 Dec 6 06:49 share
drwxr-x--- 5 root mysql 4096 Dec 6 06:50 sql-bench
drwxr-x--- 2 root mysql 4096 Dec 6 06:50 libexec
drwxr-x--- 4 mysql mysql 4096 Dec 6 21:01 var
为账号设置密码.
在 bin目录下运行
mysqladmin -u root password "newpasswd"
就可以进行基本的使用了.