-
Mysql Startup Tutorial
Mysql Startup Tutorial
Common Required Packages
Following RPM are required to setup a normal Mysql database server.
1. mysql-server
2. mysql
3. php-mysql (if php is going to access mysql)
Use rpm command to install these packages.
Eg:
[root@tmp server]# rpm -ivh mysql-server-5.0.77-4.el5_4.2
Configuration file
/etc/my.cnf
The /etc/my.cnf file is the main MySQL configuration file. It sets the default MySQL database location and other parameters.
Port
Mysql default port is 3306
Setting up root password
First Time
mysqladmin -uroot password $MYSQLPW
MySQL stores all its username and password data in a special database named mysql. You can add users to this database and specify the databases to which they will have access with the grant command. The MySQL root or superuser account, which is used to create and delete databases, is the exception. You need to use the mysqladmin command to set your root password. Only two steps are necessary for a brand new MySQL installation.
1. Make sure MySQL is started.
2. Use the mysqladmin command to set the MySQL root password. The syntax is as follows:
[root@tmp server]# mysqladmin -u root password new-password
Reset Root Password on running Mysql
1. Stop the Mysql
[root@localhost ~]# /etc/init.d/mysqld stop
2. Start again with mysqlsafe
[root@localhost ~]# mysqld_safe --skip-grant-tables &
3. From another terminal,
[root@localhost ~]# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
In the mysql database, there is one table named as "user" in that table set password for the user root.
4. Restart Mysql
[root@localhost ~]# /etc/init.d/mysqld restart
Accessing The MySQL Command Line
MySQL command line interpreter (CLI) can be accessed as follows.
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 53
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Basic mysql tasks in CLI
1. List the databases in the server.
mysql> show databases;
2. Create a database
mysql> create database mynewdatabasename;
3. Delete a databse(drop)
mysql> drop database unwanteddatabasename;
4. create a user
mysql> create user newusername;
5. List the users
mysql> select user from mysql.user;
6. Providing privilages to one user on one database
mysql> grant all privileges on database.* to username@"servername" identified by 'password';
mysql> flush privileges;
The flush privileges is used to write the privilege changes to the mysql.sql database
7. Delete a user
mysql> drop user test;
Backup a Database
We can use mysqldump for backup a mysql database.
[root@localhost ~]# mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]
Eg:
[root@localhost ~]# mysqldump -u root -p mysecret mydatabase > mydatabasebackup.sql
Using this method, we can create a backup as sql file. If the case is a huge database, we can use the standard pipes to dump and zip.
Eg:
mysqldump -uroot -pmysecret --database mybigdatabase | gzip -c > mybigdatabase.sql.gz;
In Some time, putting the password in command will cause security problems. In such case, we can use mysqldump in the following manner.
[root@localhost ~]# mysqldump -u root -p database > database.sql
in this case we will be asked for the root password when the command executed.
Restore a Database
[root@localhost ~]# mysql -u user -p 'password' db-name < db-name.sql
If the password needs to be secured,
[root@localhost ~]# mysql -u user -p db-name < db-name.sql
Ref: http://nixcraft.com
more
-
iptables configuration file
/etc/iptables.up.rules
# Generated by iptables-save v1.4.4 on Tue Jul 6 19:02:33 2010
*nat
:PREROUTING DROP [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -d 8.8.8.8 -i eth1 -j ACCEPT
-A PREROUTING -d 4.4.4.4 -i eth1 -j ACCEPT
-A PREROUTING -d w.x.y.z -i eth1 -j ACCEPT #(old mail server ip)
-A PREROUTING -d a.b.c.d -i eth1 -j ACCEPT #(mail server ip)
-A PREROUTING -d mail.uvw.in -i eth1 -j ACCEPT
-A PREROUTING -d l.m.n.o/29 -i eth1 -j ACCEPT #(old network ip)
-A PREROUTING -d r.s.t.u -i eth1 -j ACCEPT #(proxy server ip)
-A PREROUTING -d 122.c.d.146 -i eth1 -j ACCEPT #(allow ip)
-A PREROUTING -d 122.e.f.147 -i eth1 -j ACCEPT #(allow ip)
# Samba and Proxy
-A PREROUTING -p tcp -m tcp -m multiport -i eth1 -j ACCEPT --dports 139,445,3128,9000
-A POSTROUTING -s 10.1.5.0/24 -o eth0 -j MASQUERADE
-A PREROUTING -p tcp -m tcp --dport 11500 -j ACCEPT
-A PREROUTING -p tcp -m tcp -m multiport -i eth1 -j REDIRECT --to-ports 3128 --dports 80,8080,9000
COMMIT
# Completed on Tue Jul 6 19:02:33 2010
# Generated by iptables-save v1.4.4 on Tue Jul 6 19:02:33 2010
*mangle
:PREROUTING ACCEPT [602:341342]
:INPUT ACCEPT [568:338000]
:FORWARD ACCEPT [34:3342]
:OUTPUT ACCEPT [676:370648]
:POSTROUTING ACCEPT [710:373990]
COMMIT
# Completed on Tue Jul 6 19:02:33 2010
# Generated by iptables-save v1.4.4 on Tue Jul 6 19:02:33 2010
*filter
:INPUT ACCEPT [568:338000]
:FORWARD ACCEPT [34:3342]
:OUTPUT ACCEPT [676:370648]
COMMIT
# Completed on Tue Jul 6 19:02:33 2010
more
-
Network/ethernet card configuration file
Editing file /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address w.x.y.z
netmask 255.255.255.248
gateway w.x.y.u
dns-nameservers a.b.c.d
metric 1
post-up iptables-restore < /etc/iptables.up.rules
#Secondary network interface
auto eth1
iface eth1 inet static
address 10.1.5.1
netmask 255.255.255.0
network 10.1.5.0
broadcast 10.1.5.255
metric 2
more
-
Relational Database - Codd's Rules
Relational Database - Codd's Rules !!!A relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd. Most popular commercial and open source databases currently in use are based on the relational database model.A short definition of an RDBMS may be a DBMS in which data is stored in the form of tables and the relationship among the data is also stored in the form of tables.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">Codd's Rules- All database management must take place using the relational database's innate functionality
- All information in the database must be stored as values in a table
- All database information must be accessible through the combination of a table name, primary key and column name.
- The database must use NULL values to indicate missing or unknown information
- The database schema must be described using the relational database syntax
- The database may support multiple languages, but it must support at least one language that provides full database functionality (e.g. SQL)
- The system must be able to update all updatable views
- The database must provide single-operation insert, update and delete functionality
- Changes to the physical structure of the database must be transparent to applications and users.
- Changes to the logical structure of the database must be transparent to applications and users.
- The database must natively support integrity constraints.
- Changes to the distribution of the database (centralized vs. distributed) must be transparent to applications and users.
- Any languages supported by the database must not be able to subvert integrity controls.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">Tags: database, table, DBMS, RDBMS, columns, Codd, E. F. Codd, rules, oracle, data================================================ O************************O***********************O
more
-
Apt-Get command line tool
Apt-Get command line tool(Ubuntu's Advanced Packaging Tool) !!!
The apt-get command is a powerful command-line tool used to work with Ubuntu's Advanced Packaging Tool (APT) performing such functions as installation of new software packages, upgrade of existing software packages, updating of the package list index, and even upgrading the entire Ubuntu system.
*Install package
#sudo apt-get install packagename
*Remove Package
#sudo apt-get remove packagename
*Install Multiple Packages
#sudo apt-get install packagename1 packagename2 packagename3
*Update the Package Index
#sudo apt-get updateThe APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file.
*Upgrade the system
#sudo apt-get upgrade
*Read Debian APT User Manual
#sudo apt-get helpTags: apt get apt-get advanced packaging tool install remove upgrade update help ubuntu linux unix package-management
more
-
Port Numbers - Linux
PORTS NUMBERS : Just as the physical address (MAC address) and the logical address (IP address) helps to route the traffic to a particular machine on a network, it is the port that identifies which service on the machine this traffic is destined to.
List of ports : /etc/servicesA port on a specific computer is called a socket. It can be open, closed, listening or have a connection established.
###Important PORT NUMBERS to remember:20 - FTP - data transfer21 - FTP - control (command)22 - SSH23 - Telnet25 - SMTP37 - Time43 - WHOIS42 - WINS53 - DNS67 - BOOTp68 - DHCP69 - TFTP79 - FINGER80 - HTTP (WWW)88 - Kerberose101 - HOSTNAME110 - POP3111 - rpcbind119 - NNTP123 - NTP (Time)137 - NetBios (nmbd)139 - NetBios ( Samba)143 - IMAP/Dovecot161 - SNMP180 - RIS220 - IMAP3389 - LDAP443 - HTTPs500 - Internet Key Exchange (IKE), IPSec520 - RIP546 - DHCPV6 client547 - DHCPV6 server554 - rtsp(Real Time Stream Protocol, Audio/Video)631 - Printing (ipp)744 - Flexlm901 - SWAT953 - rndc993 - IMAPSecure995 - POPs999 - POP over SSL/TLS2049 - NFS2082 - CPANEL2083 - CPANEL Secure SSL/TLS2086 - CPANEL WHM2087 - CPANEL WHM Secure/SSL2095 - CPANEL Webmail2096 - CPANEL Webmail Secure/SSL2222 - Direct Admin Control Panel2401 - CVSP server3268 - AD Global Catalog3269 - AD Global Catalog over SSL3306 - MySQL Server3389 - Terminal services (rdp-remote desktop protocol)4643 - Virtusso Power Panel(6000 - X116063)8443 - Pleask Control Panel9999 - Urchin10000- Webmin Control Panel21018- Skype
TAG: port, portnumber, port-numbers, tcp, udp, network, service, services, linux, socket, communication, transmission, dataflow, rhce, ubuntu, unix, red hat, red-hat, redhat
more
-
How to install Webmin
WEBMINWebmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely.
Install Webmin (Successfully tested/configured on Ubuntu server 10.04)
#sudo aptitude safe-upgrade
#sudo aptitude update
#sudo mkdir downloads
#cd downloads
#sudo wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb?use_mirror=cdnetworks-us-1
or
#sudo wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb?use_mirror=kent
#sudo dpkg -i webmin_1.510-2_all.deb
#sudo aptitude -f install=>>You can access the Ubuntu machine from a Windows machine via a web browser by typing the addresshttps://yourip:10000
or
https://core:10000 , here core is the name of my Ubuntu server.Tags: webmin web-based interface system administration admistrator configure linux server ubuntu red hat redhat rhel rhce unix
more
Subscribe to:
Posts (Atom)
.
