Google
 

How To: MYSQL Server

MYSQL Installation

1. Installation

[root@proxy conf]# yum install mysql mysql-devel mysql-server

Setting up Install Process

Setting up repositories

Reading repository metadata in from local files

Parsing package install arguments

Resolving Dependencies

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for mysql-devel to pack into transaction set.

mysql-devel-4.1.20-3.RHEL 100% |=========================| 25 kB 00:00

---> Package mysql-devel.i386 0:4.1.20-3.RHEL4.1.el4_6.1 set to be updated

---> Package mysql-server.i386 0:4.1.20-3.RHEL4.1.el4_6.1 set to be updated

---> Package mysql.i386 0:4.1.20-3.RHEL4.1.el4_6.1 set to be updated

--> Running transaction check

--> Processing Dependency: openssl-devel for package: mysql-devel

--> Processing Dependency: perl-DBD-MySQL for package: mysql-server

--> Restarting Dependency Resolution with new changes.

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for openssl-devel to pack into transaction set.

openssl-devel-0.9.7a-43.1 100% |=========================| 126 kB 00:06

---> Package openssl-devel.i586 0:0.9.7a-43.17.el4_6.1 set to be updated

---> Package perl-DBD-MySQL.i386 0:2.9004-3.1.centos4 set to be updated

--> Running transaction check

--> Processing Dependency: zlib-devel for package: openssl-devel

--> Processing Dependency: krb5-devel for package: openssl-devel

--> Restarting Dependency Resolution with new changes.

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for krb5-devel to pack into transaction set.

krb5-devel-1.3.4-54.el4_6 100% |=========================| 40 kB 00:00

---> Package krb5-devel.i386 0:1.3.4-54.el4_6.1 set to be updated

---> Downloading header for zlib-devel to pack into transaction set.

zlib-devel-1.2.1.2-1.2.i3 100% |=========================| 6.2 kB 00:00

---> Package zlib-devel.i386 0:1.2.1.2-1.2 set to be updated

--> Running transaction check

--> Processing Dependency: krb5-libs = 1.3.4-54.el4_6.1 for package: krb5-devel

--> Processing Dependency: e2fsprogs-devel for package: krb5-devel

--> Restarting Dependency Resolution with new changes.

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for e2fsprogs-devel to pack into transaction set.

e2fsprogs-devel-1.35-12.1 100% |=========================| 20 kB 00:00

---> Package e2fsprogs-devel.i386 0:1.35-12.11.el4_6.1 set to be updated

---> Downloading header for krb5-libs to pack into transaction set.

krb5-libs-1.3.4-54.el4_6. 100% |=========================| 33 kB 00:00

---> Package krb5-libs.i386 0:1.3.4-54.el4_6.1 set to be updated

--> Running transaction check

--> Processing Dependency: krb5-libs = 1.3.4-54 for package: krb5-workstation

--> Restarting Dependency Resolution with new changes.

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for krb5-workstation to pack into transaction set.

krb5-workstation-1.3.4-54 100% |=========================| 41 kB 00:01

---> Package krb5-workstation.i386 0:1.3.4-54.el4_6.1 set to be updated

--> Running transaction check

Dependencies Resolved

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

Package Arch Version Repository Size

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

Installing:

mysql i386 4.1.20-3.RHEL4.1.el4_6.1 update 2.9 M

mysql-devel i386 4.1.20-3.RHEL4.1.el4_6.1 update 2.1 M

mysql-server i386 4.1.20-3.RHEL4.1.el4_6.1 update 9.8 M

Installing for dependencies:

e2fsprogs-devel i386 1.35-12.11.el4_6.1 update 487 k

krb5-devel i386 1.3.4-54.el4_6.1 update 824 k

openssl-devel i586 0.9.7a-43.17.el4_6.1 base 1.6 M

perl-DBD-MySQL i386 2.9004-3.1.centos4 base 111 k

zlib-devel i386 1.2.1.2-1.2 base 89 k

Updating for dependencies:

krb5-libs i386 1.3.4-54.el4_6.1 update 484 k

krb5-workstation i386 1.3.4-54.el4_6.1 update 824 k

Transaction Summary

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

Install 8 Package(s)

Update 2 Package(s)

Remove 0 Package(s)

Total download size: 19 M

Is this ok [y/N]:y

Downloading Packages:

(1/7): mysql-devel-4.1.20 100% |=========================| 2.1 MB 00:42

(2/7): krb5-devel-1.3.4-5 100% |=========================| 824 kB 00:19

(3/7): e2fsprogs-devel-1. 100% |=========================| 487 kB 00:08

(4/7): krb5-workstation-1 100% |=========================| 824 kB 00:13

(5/7): openssl-devel-0.9. 100% |=========================| 1.6 MB 00:29

(6/7): zlib-devel-1.2.1.2 100% |=========================| 89 kB 00:02

(7/7): krb5-libs-1.3.4-54 100% |=========================| 484 kB 00:18

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Updating : krb5-libs ####################### [ 1/12]

Installing: mysql ####################### [ 2/12]

Installing: perl-DBD-MySQL ####################### [ 3/12]

Installing: zlib-devel ####################### [ 4/12]

Installing: e2fsprogs-devel ####################### [ 5/12]

Installing: krb5-devel ####################### [ 6/12]

Installing: openssl-devel ####################### [ 7/12]

Installing: mysql-devel ####################### [ 8/12]

Updating : krb5-workstation ####################### [ 9/12]

Installing: mysql-server ####################### [10/12]

Cleanup : krb5-workstation ####################### [11/12]

Cleanup : krb5-libs ####################### [12/12]

Installed: mysql.i386 0:4.1.20-3.RHEL4.1.el4_6.1 mysql-devel.i386 0:4.1.20-3.RHEL4.1.el4_6.1 mysql-server.i386 0:4.1.20-3.RHEL4.1.el4_6.1

Dependency Installed: e2fsprogs-devel.i386 0:1.35-12.11.el4_6.1 krb5-devel.i386 0:1.3.4-54.el4_6.1 openssl-devel.i586 0:0.9.7a-43.17.el4_6.1 perl-DBD-MySQL.i386 0:2.9004-3.1.centos4 zlib-devel.i386 0:1.2.1.2-1.2

Dependency Updated: krb5-libs.i386 0:1.3.4-54.el4_6.1 krb5-workstation.i386 0:1.3.4-54.el4_6.1

Complete!

2. Check the installation.

a. If its properly installed.

[root@proxy ~]# rpm -qa|grep mysql

mysql-4.1.20-3.RHEL4.1.el4_6.1

mysql-devel-4.1.20-3.RHEL4.1.el4_6.1

mysql-server-4.1.20-3.RHEL4.1.el4_6.1

b. Start/Stop/Restart the service.

[root@proxy /]# service mysqld start

Starting MySQL: [ OK ]

[root@proxy /]# service mysqld stop

[root@proxy /]# service mysqld restart

c. Checking at boot time.

[root@proxy /]# /sbin/chkconfig mysqld on

[root@proxy /]# /sbin/chkconfig --list mysqld

mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off

d. Check if its listening on the port

[root@azcomm ~]# netstat -tap |grep mysql

tcp 0 0 *:mysql *:* LISTEN 4443/mysqld

3. Configure your password

a. Creating a MySQL "root" Account

[root@machine etc]# mysqladmin -u root password 12345678

b. Accessing The MySQL Command Line

[root@machine etc]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4 to server version: 4.1.20

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

mysql> show databases;

+----------+

| Database |

+----------+

| mysql |

| test |

+----------+

2 rows in set (0.00 sec)

c. Create a sample db.

mysql> create database jepoy;

Query OK, 1 row affected (0.00 sec)

mysql> show databases;

+----------+

| Database |

+----------+

| jepoy |

| mysql |

| test |

+----------+

3 rows in set (0.01 sec)

d. Granting Privileges to Users

sql> grant all privileges on database.* to username@"servername" identified by 'password';

sql> grant all privileges on salesdb.* to mysqluser@"localhost" identified by 'mypass';

sql> flush privileges;