Install MySQL JDK tomcat in Linux

Source: Internet
Author: User
Tags gz file

1. Install MySql in yum

1. [root @ sample ~] # Yum-y install mysql-Server Plugin install MySQL
...
Installed: mysql-server.i386. 1.20-1. rhel4.1
Dependency installed: mysql. i386. 1.20-1. rhel4.1 perl-DBD-MySQL.i386. 9004-3.1 perl-DBI.i386. 40-8
Complete!

Ii. Configuration
[Root @ sample ~] # Vi/etc/My. CNF plugin edit the MySQL configuration file

[Mysqld]
Datadir =/var/lib/MySQL
Socket =/var/lib/MySQL. Sock
# Default to using old password format for compatibility with MySQL 3.x
# Clients (those using the mysqlclient10 compatibility package ).
Old_passwords = 1 encode find this line, add a new rule below this line, let MySQL's default code as UTF-8
Default-character-set = GBK character add this line
Add the following statement at the end of the configuration file:

[MySQL]
Default-character-set = GBK

Iii. Start the MySQL Service

[Root @ sample ~] # Chkconfig mysqld on startup

[Root @ sample ~] # Chkconfig -- list mysqld restart confirm that MySQL is started automatically
Mysqld 0: off 1: off 2: On 3: On 4: On 5: on 6: off okay if 2--5 is on

[Root @ sample ~] #/Etc/rc. d/init. d/mysqld start slave start MySQL Service

Start MySQL [OK]

Note: If this part fails to be executed, it may be that/var/lib/MySQL does not have a database file, and a [fatal error: Can't open and lock privilege tables: Table 'mysql. host 'doesn' t exist], which is OK if you need to execute the mysql_install_db command.

Iv. Set the password for the root user of MySQL
When MySQL was just installed, its root user was not set a password. First, set the MySQL Root Password.

[Root @ sample ~] # Mysql-u root login use the root user to log on to the MySQL server
Mysql> Select User, host, password from mysql. User; login view user information
Mysql> set password for root @ localhost = PASSWORD ('Enter the root password' here); then set the root password
Mysql> set password for root @ domain name = PASSWORD ('Enter the root password' here ');
Mysql> Delete from mysql. User where user = ''; anonymous deletes Anonymous Users
Mysql> exit MySQL Server [test whether the password is correct]

5. Delete A Test Database
Mysql> show databases; Databases
Mysql> drop database test; empty Delete empty database named Test

6. Test MySQL. This includes creating new users and using commands for database operations on relational databases to try to create databases and data tables. Here, the new user uses sleinetpub as an example.

[Root @ sample ~] # Mysql-u root-P login using the password to log on as root
Enter Password: Enter password here

mysql> grant all privileges on test. * To sleinetpub @ localhost identified by 'define the password' here. The login creates a user named sleinetpub who has full operation permissions on the test database.
mysql> Select User From MySQL. user where user = 'sleinetpub'; confirm whether the sleinetpub user exists.
mysql> exit from MySQL server
[root @ sample ~] # Mysql-u sleinetpub-P login log on to the MySQL server with the newly created sleinetpub user
enter password: Login enter the password here
mysql> Create Database test; create a database named test
mysql> show databases; view the existing database in the System
mysql> use test environment to connect to the database
mysql> Create Table Test (Num int, name varchar (50 )); ← create a table in the database
mysql> show tables; Tables view existing tables in the database
mysql> drop table test; deleting tables
mysql> show databases; checking to view existing databases
empty set (0.01 Sec) confirm that the test database has been deleted (the database named MySQL is not visible because it is not the root user)
mysql> exit login to log out of the MySQL server

7. Delete legacy users used for testing
[Root @ sample ~] # Mysql-u root-P login using the password to log on as root
Enter Password: Enter password here
Mysql> revoke all privileges on *. * From sleinetpub @ localhost; Revoke cancels the operation permissions of the sleinetpub user on the database.
Mysql> Delete from mysql. User where user = 'sleinetpub' and host = 'localhost'; users Delete sleinetpub users
Mysql> Select User From mysql. User where user = 'sleinetpub'; locate the user sleinetpub and check whether the user has been deleted.
Empty set (0.01 Sec) Validation sleinetpub user does not exist
Mysql> flush privileges; volume refresh to make the above operations take effect
Mysql> exit

8. Restart the HTTP service once.

[Root @ undefined/] #/etc/rc. d/init. d/mysqld stop quit stop HTTP service
Stop MySQL [OK]

[Root @ undefined/] #/etc/rc. d/init. d/mysqld start restart start HTTP service
Start MySQL [OK]

========================================================== ========================================================== ================

2. Install 1.6jdk

1. Download jdk-6u20-linux-i586.bin

Uploaded to any directory on the server

2. Enter

Chmod
755 jdk-6u20-linux-i586-rpm.bin

3. See
InstallProgramOn the page asking if you want to abide by the license agreement, press enter and enter a space.

A line of words appears: Do you aggree to the above
License terms? [Yes or No]

The installer asks if you are willing to comply with the license agreement you just saw. Of course you have to agree. Enter "Y"
Or
"Yes", Press enter.

4. Enter the following in the command line:


VI/etc/profile

Add the following content to it:

Java_home =/usr/Java/jdk1.6.0 _ 26

Path = $ java_home/bin: $ path

Classpath =.: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar

Export java_home

Export path

Export classpath

5. Go to the/usr/bin/directory.


CD/usr/bin


Ln-S-F/usr/Java/jdk1.6.0 _ 20/JRE/bin/Java


Ln-S-F/usr/Java/jdk1.6.0 _ 20/bin/javac

6. Enter


Java-version

Screen output:


Java version "jdk1.6.0 _ 20"
Java (TM) 2 Runtime Environment,
Standard Edition (build jdk1.6.0 _ 20)
Java hotspot (TM) Client VM
(Build jdk1.6.0 _ 20, mixed mode)

7. jdk1.6 installation is complete.

3. install Tomcat

1. Download apache-tomcat-5.5.30.tar.gz

2. Use filezilla client to upload the file to the/tools directory
3. decompress the GZ File

# Tar
-Zxvf/tools/apache-tomcat-5.5.30.tar.gz
5. Move Apache to the following directory
# Mv/tools/Apache-Tomcat-5.5.30/
6. Go to the Apache/bin directory.
# Cd/Apache-Tomcat-5.5.30/bin
7. Enable and disable services
#./Startup. Sh // start Tomcat

Show using
Catalina_base:/usr/local/tomcat

Using catalina_home:/usr/local/tomcat

Using catalina_temdir:
/Usr/local/tomcat/temp

Using java_home:/usr/Java/jdk1.6.0 _ 20

Now That tomcat has been installed, visit http: // localhost: 8080 in the browser. The default Tomcat page appears, indicating that the installation is successful.

#./Shutdown. Sh // close Tomcat

8. View and kill Processes
# Ps-Ef | grep Tomcat
# Kill-9 # pid #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.