linuxs下的jdk+tomcat+mysql配置具体步骤

Xshell:\>
Connecting to 192.168.43.128:22...
Connection established.
Escape character is '^@]'.

/usr/bin/xauth:  creating new authority file /root/.Xauthority
[root@localhost ~]# ipconfig
-bash: ipconfig: command not found
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:95:88:4E  
          inet addr:192.168.43.128  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe95:884e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:146 errors:0 dropped:0 overruns:0 frame:0
          TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:13338 (13.0 KiB)  TX bytes:9373 (9.1 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 b)  TX bytes:480 (480.0 b)

[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog
[root@localhost ~]# cd /usr/local/tmp
[root@localhost tmp]# ls
jdk-7u80-linux-x64.tar.gz
[root@localhost tmp]# tar zxf jdk-7u80-linux-x64.tar.gz
[root@localhost tmp]# ls
jdk1.7.0_80  jdk-7u80-linux-x64.tar.gz
[root@localhost tmp]# cp -r jdk1.7.0_80 /usr/local/jdk7
[root@localhost tmp]# cd ..
[root@localhost local]# ls
bin  etc  games  include  jdk7  lib  lib64  libexec  sbin  share  src  tmp
[root@localhost local]# vim /etc/profile
[root@localhost local]# source /etc/profile
[root@localhost local]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@localhost local]# vim /etc/profile
[root@localhost local]# source /etc/profile
[root@localhost local]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@localhost local]# cd tmp
[root@localhost tmp]# vim demo.java
[root@localhost tmp]# javac demo.java
demo.java:3: error: package system does not exist
system.out.println("hello world");
      ^
1 error
[root@localhost tmp]# vim demo.java
[root@localhost tmp]# javac demo.java
[root@localhost tmp]# java demo
hello world
[root@localhost tmp]# ls
apache-tomcat-7.0.68.tar.gz  demo.class  demo.java  jdk1.7.0_80  jdk-7u80-linux-x64.tar.gz  mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
[root@localhost tmp]# tar zxf apache-tomcat-7.0.68.tar.gz
[root@localhost tmp]# ls
apache-tomcat-7.0.68  apache-tomcat-7.0.68.tar.gz  demo.class  demo.java  jdk1.7.0_80  jdk-7u80-linux-x64.tar.gz  mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
[root@localhost tmp]# cp -r apache-tomcat-7.0.68 ../tomcat
[root@localhost tmp]# cd ..
[root@localhost local]# ls
bin  etc  games  include  jdk7  lib  lib64  libexec  sbin  share  src  tmp  tomcat
[root@localhost local]# cd /etc/profile
-bash: cd: /etc/profile: Not a directory
[root@localhost local]# vim /etc/profile
[root@localhost local]# source /etc/profile
[root@localhost local]# cd tomcat
[root@localhost tomcat]# cd bin
[root@localhost bin]# ls
bootstrap.jar  catalina.sh         commons-daemon.jar            configtest.bat  daemon.sh   digest.sh         setclasspath.sh  shutdown.sh  startup.sh       tomcat-native.tar.gz  tool-wrapper.sh  version.sh
catalina.bat   catalina-tasks.xml  commons-daemon-native.tar.gz  configtest.sh   digest.bat  setclasspath.bat  shutdown.bat     startup.bat  tomcat-juli.jar  tool-wrapper.bat      version.bat
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/jdk7
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@localhost bin]# vim /etc/sysconfig/iptables
[root@localhost bin]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@localhost bin]# ls
bootstrap.jar  catalina.sh         commons-daemon.jar            configtest.bat  daemon.sh   digest.sh         setclasspath.sh  shutdown.sh  startup.sh       tomcat-native.tar.gz  tool-wrapper.sh  version.sh
catalina.bat   catalina-tasks.xml  commons-daemon-native.tar.gz  configtest.sh   digest.bat  setclasspath.bat  shutdown.bat     startup.bat  tomcat-juli.jar  tool-wrapper.bat      version.bat
You have mail in /var/spool/mail/root
[root@localhost bin]# ./shutdown.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/jdk7
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@localhost bin]# ./startup.sh & tailf /usr/local/tomcat/logs/catalina.out
[1] 35423
Jun 26, 2019 12:48:23 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jun 26, 2019 12:48:23 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Jun 26, 2019 12:48:23 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Jun 26, 2019 12:48:23 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Jun 26, 2019 12:48:23 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/jdk7
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
Jun 26, 2019 12:49:25 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/7.0.68
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Feb 8 2016 20:25:54 UTC
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         7.0.68.0
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Linux
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            2.6.32-431.el6.x86_64
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             /usr/local/jdk7/jre
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.7.0_80-b15
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         /usr/local/tomcat
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         /usr/local/tomcat
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/usr/local/tomcat/endorsed
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/usr/local/tomcat
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/usr/local/tomcat
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
Jun 26, 2019 12:49:26 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Jun 26, 2019 12:49:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 26, 2019 12:49:26 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1723 ms
Jun 26, 2019 12:49:26 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 26, 2019 12:49:26 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.68
Jun 26, 2019 12:49:26 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/tomcat/webapps/manager
Jun 26, 2019 12:49:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/local/tomcat/webapps/manager has finished in 1,331 ms
Jun 26, 2019 12:49:27 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/tomcat/webapps/examples
Jun 26, 2019 12:49:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/local/tomcat/webapps/examples has finished in 824 ms
Jun 26, 2019 12:49:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/tomcat/webapps/host-manager
Jun 26, 2019 12:49:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/local/tomcat/webapps/host-manager has finished in 156 ms
Jun 26, 2019 12:49:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/tomcat/webapps/docs
Jun 26, 2019 12:49:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/local/tomcat/webapps/docs has finished in 108 ms
Jun 26, 2019 12:49:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/tomcat/webapps/ROOT
Jun 26, 2019 12:49:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /usr/local/tomcat/webapps/ROOT has finished in 137 ms
Jun 26, 2019 12:49:29 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 26, 2019 12:49:29 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 26, 2019 12:49:29 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2768 ms
^C
[1]+  Done                    ./startup.sh
[root@localhost bin]# cd /usr/local/tmp
[root@localhost tmp]# ls
apache-tomcat-7.0.68  apache-tomcat-7.0.68.tar.gz  demo.class  demo.java  jdk1.7.0_80  jdk-7u80-linux-x64.tar.gz  mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
[root@localhost tmp]# tar zxf mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
[root@localhost tmp]# ls
apache-tomcat-7.0.68  apache-tomcat-7.0.68.tar.gz  demo.class  demo.java  jdk1.7.0_80  jdk-7u80-linux-x64.tar.gz  mysql-5.6.31-linux-glibc2.5-x86_64  mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
[root@localhost tmp]# cp -r mysql-5.6.31-linux-glibc2.5-x86_64 ../mysql
[root@localhost tmp]# groupadd mysql
[root@localhost tmp]# useradd -r -g mysql mysql
[root@localhost tmp]# cd ..
[root@localhost local]# cd mysql
[root@localhost mysql]# chgrp -R mysql .
[root@localhost mysql]# chown -R mysql .
[root@localhost mysql]# ls /etc/my.cnf
/etc/my.cnf
[root@localhost mysql]# rm /etc/my.cnf
rm: remove regular file `/etc/my.cnf'? y
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2019-06-26 13:08:11 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-26 13:08:11 0 [Note] ./bin/mysqld (mysqld 5.6.31) starting as process 35505 ...
2019-06-26 13:08:11 35505 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-06-26 13:08:11 35505 [Note] InnoDB: The InnoDB memory heap is disabled
2019-06-26 13:08:11 35505 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-26 13:08:11 35505 [Note] InnoDB: Memory barrier is not used
2019-06-26 13:08:11 35505 [Note] InnoDB: Compressed tables use zlib 1.2.3
2019-06-26 13:08:11 35505 [Note] InnoDB: Using Linux native AIO
2019-06-26 13:08:11 35505 [Note] InnoDB: Using CPU crc32 instructions
2019-06-26 13:08:11 35505 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-06-26 13:08:11 35505 [Note] InnoDB: Completed initialization of buffer pool
2019-06-26 13:08:11 35505 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2019-06-26 13:08:11 35505 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2019-06-26 13:08:11 35505 [Note] InnoDB: Database physically writes the file full: wait...
2019-06-26 13:08:11 35505 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2019-06-26 13:08:11 35505 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2019-06-26 13:08:11 35505 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2019-06-26 13:08:11 35505 [Warning] InnoDB: New log files created, LSN=45781
2019-06-26 13:08:11 35505 [Note] InnoDB: Doublewrite buffer not found: creating new
2019-06-26 13:08:11 35505 [Note] InnoDB: Doublewrite buffer created
2019-06-26 13:08:11 35505 [Note] InnoDB: 128 rollback segment(s) are active.
2019-06-26 13:08:11 35505 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-26 13:08:11 35505 [Note] InnoDB: Foreign key constraint system tables created
2019-06-26 13:08:11 35505 [Note] InnoDB: Creating tablespace and datafile system tables.
2019-06-26 13:08:11 35505 [Note] InnoDB: Tablespace and datafile system tables created.
2019-06-26 13:08:11 35505 [Note] InnoDB: Waiting for purge to start
2019-06-26 13:08:11 35505 [Note] InnoDB: 5.6.31 started; log sequence number 0
2019-06-26 13:08:12 35505 [Note] Binlog end
2019-06-26 13:08:12 35505 [Note] InnoDB: FTS optimize thread exiting.
2019-06-26 13:08:12 35505 [Note] InnoDB: Starting shutdown...
2019-06-26 13:08:13 35505 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2019-06-26 13:08:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-26 13:08:13 0 [Note] ./bin/mysqld (mysqld 5.6.31) starting as process 35527 ...
2019-06-26 13:08:13 35527 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-06-26 13:08:13 35527 [Note] InnoDB: The InnoDB memory heap is disabled
2019-06-26 13:08:13 35527 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-26 13:08:13 35527 [Note] InnoDB: Memory barrier is not used
2019-06-26 13:08:13 35527 [Note] InnoDB: Compressed tables use zlib 1.2.3
2019-06-26 13:08:13 35527 [Note] InnoDB: Using Linux native AIO
2019-06-26 13:08:13 35527 [Note] InnoDB: Using CPU crc32 instructions
2019-06-26 13:08:13 35527 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2019-06-26 13:08:13 35527 [Note] InnoDB: Completed initialization of buffer pool
2019-06-26 13:08:13 35527 [Note] InnoDB: Highest supported file format is Barracuda.
2019-06-26 13:08:13 35527 [Note] InnoDB: 128 rollback segment(s) are active.
2019-06-26 13:08:13 35527 [Note] InnoDB: Waiting for purge to start
2019-06-26 13:08:13 35527 [Note] InnoDB: 5.6.31 started; log sequence number 1625977
2019-06-26 13:08:13 35527 [Note] Binlog end
2019-06-26 13:08:13 35527 [Note] InnoDB: FTS optimize thread exiting.
2019-06-26 13:08:13 35527 [Note] InnoDB: Starting shutdown...
2019-06-26 13:08:15 35527 [Note] InnoDB: Shutdown completed; log sequence number 1625987
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:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

  ./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 . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as ./my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[root@localhost mysql]# cp support-files/my-default.cnf /etc/my.cnf
[root@localhost mysql]# cp support-files/my-default.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? n
[root@localhost mysql]# cp support-files/mysql.server      /etc/rc.d/init.d/mysql
[root@localhost mysql]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
[root@localhost mysql]# service mysql start
Starting MySQL.. SUCCESS!
[root@localhost mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show datebases
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'datebases' at line 1
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[root@localhost mysql]# vim /etc/my.cnf
[root@localhost mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password= passworD ("smallming") where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> update user set password=passworD("root")where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> mysql -u root -p
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p' at line 1
mysql> Ctrl-C -- exit!
Aborted
[root@localhost mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> Ctrl-C -- exit!
Aborted
[root@localhost mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost mysql]# no
-bash: no: command not found
[root@localhost mysql]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.6.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host from user;
+------+-----------------------+
| user | host                  |
+------+-----------------------+
| root | 127.0.0.1             |
| root | ::1                   |
|      | localhost             |
| root | localhost             |
|      | localhost.localdomain |
| root | localhost.localdomain |
+------+-----------------------+
6 rows in set (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'%' identified by "root" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,host from user;
+------+-----------------------+
| user | host                  |
+------+-----------------------+
| root | %                     |
| root | 127.0.0.1             |
| root | ::1                   |
|      | localhost             |
| root | localhost             |
|      | localhost.localdomain |
| root | localhost.localdomain |
+------+-----------------------+
7 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> Ctrl-C -- exit!
Aborted
[root@localhost mysql]# vim /etc/sysconfig/iptables
[root@localhost mysql]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@localhost mysql]#vim /etc/profile

在linuxs中如果要批量添加数据可以:

如果忘记了root密码:

即可不使用密码重新进入。

 使用客户端工具xshell连接linuxs编写代码更为方便。

 

使用FileZilla-3.42.1工具进行windows和linuxs的文件传输

 

可能存在连不上的情况,可能是因为防火墙的拦截,在linuxs中使用service iptables stop

也可能是linuxs下未开启ssh服务,使用service sshd start

资料链结:压缩包比较大,你可以去官网下载,也可以私我(2967254652),我分享给你。

转载于:https://www.cnblogs.com/aasu/p/11094095.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以通过以下步骤快速本地部署JDK+Tomcat+Apache+MySQL环境: 1. 下载并安装JDK:访问Oracle JDK网站(https://www.oracle.com/java/technologies/javase-downloads.html),选择适合您操作系统的版本并下载。安装后设置JAVA_HOME环境变量。 2. 下载并安装Tomcat:访问Apache Tomcat网站(https://tomcat.apache.org/download-90.cgi),选择最新的版本并下载。解压缩后将其放在您喜欢的目录下。 3. 下载并安装Apache:访问Apache官方网站(https://httpd.apache.org/download.cgi),选择适合您操作系统的版本并下载。安装后将其放在您喜欢的目录下。 4. 下载并安装MySQL:访问MySQL官方网站(https://www.mysql.com/downloads/),选择适合您操作系统的版本并下载。安装后设置MYSQL_HOME环境变量。 5. 配置Tomcat:在Tomcat目录下找到conf文件夹,编辑server.xml文件,将8080端口改为您喜欢的端口。 6. 配置Apache:在Apache目录下找到conf文件夹,编辑httpd.conf文件,添加以下代码: LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so ProxyPass /tomcat http://localhost:8080/ ProxyPassReverse /tomcat http://localhost:8080/ 7. 启动TomcatMySQL:在命令行窗口中分别输入以下命令: 启动Tomcat:cd [Tomcat目录]/bin,然后输入startup.bat(Windows)或startup.sh(Linux/Mac)。 启动MySQL:cd [MySQL目录]/bin,然后输入mysqld。 8. 测试:在浏览器中输入http://localhost/tomcat(如果您将Tomcat路径配置为根路径,则只需输入http://localhost/)。如果一切顺利,您将看到Tomcat的欢迎页面。 希望这些步骤可以帮助您快速在本地部署JDK+Tomcat+Apache+MySQL环境。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值