1、上传安装文件并解压
tar -zxvf apache-tomcat-7.0.82.tar.gz -C /export/install/
2、启动
进入tomcat的安装目录下有个bin。进入bin,执行启动
./startup.sh
说明:tomcat 所有的日志均打入到了安装目录下的logs文件中的catalina.out
web项目(war包格式)部署的路径是安装路径下的webapps
1、确认当前系统是否已经安装mysql
rpm -qa | grep mysql
本地原或者网络源必须存在,并且有效
2、安装mysql
yum install -y mysql-server
3、查看mysql当前状态
/etc/init.d/mysqld status 或者 service mysqld status (status 状态 start 启动 stop 停止 restart 重启)
4、启动mysql
/etc/init.d/mysqld start 或者 service mysqld start
进入mysql shell窗口
1、直接mysql + 回车
2、mysql -u用户名 -p密码 (中间没有空格)
为root用户设置密码
mysqladmin -u root password 密码(有特殊字符需要加单引号)
1、进入mysql shell窗口
2、查看当前编码格式吗
命令:show variables like ‘character_set_%’;
mysql> show variables like ‘character_set_%’;
±-------------------------±---------------------------+
| Variable_name | Value |
±-------------------------±---------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
±-------------------------±---------------------------+
3、修改mysql的 配置文件
vim /etc/my.cnf 添加如下配置 保存退出
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
4、重启mysql
service mysqld restart
5、二次确认
进入mysql shell窗口,执行查询
mysql> show variables like ‘character_set_%’;
±-------------------------±---------------------------+
| Variable_name | Value |
±-------------------------±---------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
±-------------------------±---------------------------+
1、查看当前mysql 允许哪些主机连接
进入mysqlshell ,查看mysql数据库的user表信息
select host, user ,password from user;
mysql> select host, user ,password from user;
±----------±-----±------------------------------------------+
| host | user | password |
±----------±-----±------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| node01 | root | |
| 127.0.0.1 | root | |
| localhost | | |
| node01 | | |
±----------±-----±------------------------------------------+
host :允许访问的主机
user : 主机使用的用户
password : 允许用户使用的密码
2、添加权限,让任何主机使用rootu用户 123456密码,都能访问本mysql
grant all privileges on . to ‘root’@’%’ identified by ‘123456’ with grant option;
3、刷新权限
flush privileges;
4、二次确认
mysql> select host, user ,password from user; ±----------±-----±------------------------------------------+
| host | user | password |
±----------±-----±------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| node01 | root | |
| 127.0.0.1 | root | |
| localhost | | |
| node01 | | |
*| % | root | 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
±----------±-----±------------------------------------------+
5、关闭linux 防火墙
service iptables stop
设置防火墙开机不自动启动
chkconfig iptables off
设置防火墙开机自动启动
chkconfig iptables on