admin 发表于 2014-9-25 20:55

阿里云 CentOS 6.5 64位安装JDK、tomcat、mysql

一:安装JDK
首先检测下系统是否安装jdk #rpm -qa|grep jdk
如果 显示:jdk-1.6.0_10-fcs
卸载:#rpm -e--nodepsjdk-1.6.0_10-fcs
JDK下载地址:http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.rpm
上传 JDK到指定目录
chmod +x jdk-7u67-linux-x64.rpm
rpm -ivh jdk-7u67-linux-x64.rpm

查看Java的安装路径 :http://www.52itstyle.top/thread-6367-1-1.html

①进入编辑profile文件
#vim /etc/profile
②在profile文件最后追加入如下内容:
    exportJAVA_HOME=/usr/java/jdk1.7.0_25
    exportCLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    exportPATH=$PATH:$JAVA_HOME/bin③保存并退出,执行如下
#source /etc/profile

二:安装tomcat
Tomca下载地址:http://tomcat.apache.org/download-70.cgi

下载后解压:tar -zxvf apache-tomcat-7.0.28
移动到/usr/local/tomcat7:mv apache-tomcat-7.0.28 /usr/local/tomcat7
设置目录可执行权限 chmod +x /usr/local/tomcat7

三:安装mysql
wget –c http://dev.mysql.com/get/Downloa ... -1.rhel5.x86_64.rpm

wget –c http://dev.mysql.com/get/Downloa ... -1.rhel5.x86_64.rpm

wget –c http://dev.mysql.com/get/Downloa ... -1.rhel5.x86_64.rpm

rpm -ivh MySQL-server-5.6.10-1.rhel5.x86_64.rpm

rpm -ivh MySQL-client-5.6.10-1.rhel5.x86_64.rpm

rpm -ivh MySQL-devel-5.6.10-1.rhel5.x86_64.rpm

service mysql start 启动数据库

安装完成后可能无法连接数据库错误:
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
或者
# mysql -u root -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'


解决方法如下:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root' and host='root' or host='localhost';//把空的用户密码都修改成非空的密码就行了。
mysql> FLUSH PRIVILEGES;
mysql> quit # /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

MySql5.6操作时报错:You must SET PASSWORD before executing this statement解决
mysql>SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected (0.03 sec)
mysql> create database roger;
Query OK, 1 row affected (0.00 sec)
也就是用mysql>SET PASSWORD = PASSWORD('123456');这句话重新设置一次密码!





页: [1]
查看完整版本: 阿里云 CentOS 6.5 64位安装JDK、tomcat、mysql