ALTER TABLE account_regions RENAME s3_account_regions;

[root@achappan htdocs_8085]# find . -type f | wc -l
14626
[root@achappan htdocs_8085]#

Explanation:
find . -type f finds all files ( -type f ) in this ( . ) directory and in all sub directories, the filenames are then printed to standard out one per line.
This is then piped | into wc (word count) the -l option tells wc to only count lines of its input.
Together they count all your files.

 You can create a tar archive on two ways like below.
  • To create an archive of a directory and its contents:
    • tar -cvf name.tar /path/to/directory
  • To create an archive of certfain files:
    • tar -cvf name.tar /path/to/file1 /path/to/file2 /path/to/file3
[root@achappan mysql]# df -hk /var

Filesystem                                          1K-blocks         Used                    Available            Use%  Mounted on
/dev/mapper/VolGroup00-LogVol00         271169800         141653824           115519128             56%        /

1. List down all the installed Mysql RPM's

[root@achappan mysql]# rpm -qa | grep MySQL
MySQL-server-5.5.*-1.rhel5
MySQL-client-5.5.*-1.rhel5
perl-DBD-MySQL-3.0007-2.el5
[root@achappan mysql]#

2. Remove MySQL-server and MySQL-client from the list

[root@achappan mysql]# rpm -e MySQL-server-5.5.*-1.rhel5
[root@achappan mysql]# rpm -e MySQL-client-5.5.*-1.rhel5

3.  Verify the uninstalled rpms are removed from the list or not.

[root@achappan mysql]# rpm -qa | grep MySQL
perl-DBD-MySQL-3.0007-2.el5
[root@achappan mysql]#

4.  Find the list of mysql directories from system

[root@achappan mysql]# find / -name mysql

/etc/rc.d/init.d/mysql
/etc/logrotate.d/mysql
/usr/bin/mysql
/usr/lib/mysql
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/DBD/mysql
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/DBD/mysql
/usr/share/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/var/lock/subsys/mysql
/var/run/sudo/mysql

 5. Rename or Delete the highlighted mysql directories from the list.

 6. Go to RPMs directory which you are downloaded latest rpms from mysql site.

[root@achappan mysql rpm]# ls -l
total 612100
-rw-r--r-- 1 root root  313067520 Apr 13 15:14 MySQL-5.6.24-1.rhel5.i386.rpm-bundle.tar
-rw-r--r-- 1 7155 wheel  22883979 Mar 26 16:27 MySQL-client-5.6.24-1.rhel5.i386.rpm
-rw-r--r-- 1 7155 wheel   4136019 Mar 26 16:27 MySQL-devel-5.6.24-1.rhel5.i386.rpm
-rw-r--r-- 1 7155 wheel 113129185 Mar 26 16:27 MySQL-embedded-5.6.24-1.rhel5.i386.rpm
-rw-r--r-- 1 7155 wheel  89185903 Mar 26 16:28 MySQL-server-5.6.24-1.rhel5.i386.rpm
-rw-r--r-- 1 7155 wheel   2371167 Mar 26 16:29 MySQL-shared-5.6.24-1.rhel5.i386.rpm
-rw-r--r-- 1 7155 wheel   5466510 Mar 26 16:29 MySQL-shared-compat-5.6.24-1.rhel5.i386.rpm
-rw-r--r-- 1 7155 wheel  75885537 Mar 26 16:29 MySQL-test-5.6.24-1.rhel5.i386.rpm
[root@achappan mysql rpm]#

7. Install MySQL-server and MySQL-client Rpms

[root@achappan mysql rpm]# rpm -i MySQL-server-5.6.24-1.rhel5.i386.rpm

After the MySQL Server  installation it will provide the Mysql root password in mysql_secret file under the root dir (/root/.mysql_secret)

Then install MySQL Client. You probably always want to install this package.
 [root@achappan mysql rpm]# rpm -i MySQL-client-5.6.24-1.rhel5.i386.rpm

8. Get MySQL Random generated root password

[root@achappan mysql rpm]# cat /root/.mysql_secret
# The random password set for the root user at Mon Apr 13 21:01:17 2015 (local time): mO4rRAW7Xr6Xdcy6

9. Start the mysql

[root@achappan mysql rpm]# /etc/init.d/mysql start

MySQL running (32751)                                      [  OK  ]
[root@achappan mysql rpm]#

10. Change the mysql password for your convenient.

[root@achappan mysql]# mysql -u e3user -p
Enter password: ******

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 724
Server version: 5.6.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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>
mysql> show databases;
+----------------------------------------+
| Database                               |
+----------------------------------------+
| information_schema                     |
| mysql                                  |
| performance_schema                     |
| test                                   |
+----------------------------------------+
4 rows in set (0.02 sec)
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> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('e3_user');
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
<?php

if(preg_match('/(?i)msie [1-8]/',$_SERVER['HTTP_USER_AGENT']))
{
   echo "Browser Not supported";
    exit;
}

?>
In PHP, You can display the image in HTML email template in two ways,

1. Your organization restricted your application directory by authorization and you cant able to access outside. In this case you can embed a images in html template
2. If there is no restriction and free to access anywhere you can display your image by using absolute and relative path directly

Please find the sample code for the first option:

<?php

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From="m.achappan@gmail.com";
$mail->FromName="My site's mailer";
$mail->Sender="m.achappan@gmail.com";

$address = "achappan.mahalingam@yahoo.co.in";
$mail->AddAddress($address, "Achappan Mahalingam");

$mail->Subject = "HTML Email template logo test";

$mail->IsHTML(true);

$mail->AddEmbeddedImage('email_logo.png', 'logoimg', 'email_logo.png');
$mail->Body = "<p><img src=\"cid:logoimg\" /></p>";

$mail->AltBody = "Sample html logo Image test!";

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
?>
To restart, start or stop MySQL server from the command line, type the following at the shell prompt…

/etc/init.d/mysqld start

/etc/init.d/mysqld stop 
    
/etc/init.d/mysqld restart


Some Linux flavours offer the service command too

service mysqld start 

service mysqld stop

service mysqld restart

1. Check a Specific Table in a Database

# mysqlcheck -c <dbname> <tablename> -u root -p

2. Check All Tables in a Database

# mysqlcheck -c <dbname> -u root -p

3. Check All Tables and All Databases

# mysqlcheck -c  -u root -p --all-databases 

4. Analyze Tables using Mysqlcheck

# mysqlcheck -a <dbname> <tablename> -u root -p 

5. Optimize Tables using Mysqlcheck

# mysqlcheck -o <dbname> <tablename> -u root -p 

6. Repair Tables using Mysqlcheck

# mysqlcheck -r <dbname> <tablename> -u root -p 

7. Combine Check, Optimize, and Repair Tables

# mysqlcheck -u root -p --auto-repair -c -o <dbname> 

8. Check, Optimize, and Repair All Tables from All databases

# mysqlcheck -u root -p --auto-repair -c -o --all-databases 

9. Additional Useful Mysqlcheck Options

-A, –all-databases Consider all the databases
-a, –analyze Analyze tables
-1, –all-in-1 Use one query per database with tables listed in a comma separated way
–auto-repair Repair the table automatically it if is corrupted
-c, –check Check table errors
-C, –check-only-changed Check tables that are changed since last check
-g, –check-upgrade Check for version dependent changes in the tables
-B, –databases Check more than one databases
-F, –fast Check tables that are not closed properly
–fix-db-names Fix DB names
–fix-table-names Fix table names
-f, –force Continue even when there is an error
-e, –extended Perform extended check on a table. This will take a long time to execute.
-m, –medium-check Faster than extended check option, but does most checks
-o, –optimize Optimize tables
-q, –quick Faster than medium check option
-r, –repair Fix the table corruption

Blog Archive

Total Pageviews

Popular Posts