Linux install Tomcat, the installation Mysql under Linux

Tomcat installation:
1. Extract the installation package:
-C tar -zxvf installation package name to be extracted to the target directory
-C specify an extraction location
2. Open the port:
Add Port: iptables -A INPUT -ptcp --dport port number -j ACCEPT
Save the configuration: service iptables save
Restart Firewall: service iptables restart
3. Access:
Note: If you can not access, then turn off the server and then access, if you can not access the instructions for the firewall to open the corresponding port, then in / etc / sysconfig / iptables configuration file line of script
Configuration information: -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
Start tomcat: bin directory in tomcat is using the command: sh startup.sh
Stop tomcat: sh shutdown.sh
  • Mysql installation:
1. Extract the installation package to the current directory:
tar -zxvf installation package name

 

2. unzip the file after the move to the next folder / usr / local / mysql directory and rename

After extracting the directory mv / usr / local / mysql

 

 3. Enter the mysql directory, create data directory:

mkdir data

 

 4. Create a user group mysql

groupadd mysql

5. Create user mysql

useradd -g mysql mysql

 

 6. The owner of the / usr / local / mysql directory instead mysql user

chown -R mysql .

Note: There is a space behind mysql Another English.

7. Set the mysql directory permissions

chmod -R 755 ../mysql

 

 8. initialization mysql directory:

先安装c++:yum -y install make gcc-c++ cmake bison-devel ncurses ncurses-devel libaio-devel

 

 然后再初始化:./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

报错信息:

 

 注意:如果报错: ./mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory,

那么使用命令:yum -y install numactl 来安装numactl。再重新初始化,初始化完成后记住自动生成的原始密码:puqgG:l<&4u5

 

 9.把/usr/local/mysql/support-files目录下的mysql.server复制到/etc/init.d目录下,并该名为:mysql,打开mysql文件,配置basedir和datadir两项。

 

 

 

 10.启动mysql:

/etc/init.d/mysql start

注意:要在/etc/profile配置文件中配置mysql的信息

配置信息:export PATH=/usr/local/mysql/bin:$PATH

 

 注意:如果报错:ERROR! The server quit without updating PID file (/usr/local/data/localhost.localdomain.pid).,请排查/etc/my.cnf配置文件中的配置,如果这里没错,再排查/etc/init.d/mysql配置文件。然后再启动.

my.cnf中的配置信息:

 

 mysql中的配置信息:

 

 

 

 11.连接mysql:

mysql -uroot -p

注意:如果报错:-bash: mysql: command not found

 

 执行命令:cd /usr/local/bin 进入bin目录

然后:ln -fs /usr/local/mysql/mysql.sock mysql.sock (这里的I是L的小写) 建立链接

然后再执行mysql -uroot -p 命令

 

 12.输入密码:

将生成的密码:复制过来。登陆成功

 

 13.修改密码并授权远程连接:

alter user 'root'@'localhost' identified by '123456'; (修改密码为123456)

 

 set password=password(“123456”);这个也能修改密码

use mysql;

 

 update user set user.Host='%' where user.User='root';(更新用户集)

 

 flush privileges;(刷新系统权限表)

 

 grant all privileges on *.* to 'root'@'%' ;(授权)

 

 flush privileges;

quit;(退出)

14.在etc/sysconfig/iptables配置文件中添加3306端口

 

 15.使用navicat远程连接数据库服务

安装完成!!!

Guess you like

Origin www.cnblogs.com/nukill/p/11605138.html