Tuesday, July 31, 2012

MySQL: HOW TO GET THE DATABASE SIZE FROM THE MYSQL QUERY

Run the below query you can get the Data Base Size in MySQL. 
If you run the query which is given below in MySQL Query Browser then you will get the two columns first will display the Data Base Name and the second will display the Data Base Size in MB.

mysql# SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;


And if you want to know How to view the Free space available for my Data Base in MySQL?
Run the below query:


mysql# SELECT table_schema "Data Base Name", 
sum( data_length + index_length ) / 1024 / 
1024 "Data Base Size in MB", 
sum( data_free )/ 1024 / 1024 "Free Space in MB" 
FROM information_schema.TABLES 
GROUP BY table_schema ;

.

Tuesday, July 24, 2012

Strange problem. keyboard ???

Case: I can't type U using my keyboard, it will popup Utility Manager each time.
Today, I can't use L to type my password. What happen?? When i press 'L' key, it Locked my session.


I search in Google, then found same problem like me.
http://en.kioskea.net/forum/affich-11475-strange-problem-keyboard

But for me, after i press windows key without any additinal key... .  it suddenly ok. Miracle!

.

MySQL: How to Unblock with 'mysqladmin flush-hosts' Mysql 5 and greater

MySQL Error : 
wrong authentication (username or password incorrect)
too many connections from same machine.

Solution taken: 

Clear with flush-hosts command.
See http://dev.mysql.com/doc/refman/5.1/en/flush.html

STEPS for Linux 

Open terminal window type
mysqladmin -uroot -ppassword flush-hosts;

*[Remember -uroot is your root name with a "-u" before it, and same for password "-p" before password]


Another tip 1

------------------------------------------
Restarting MySQLd solves the problem. FLUSH HOSTS also wipes the internal DNS cache, so be careful with its use - a flood of reverse DNS lookups can severely limit your server’s speed!

Open the terminal and type (for Linux)
/etc/init.d/mysql restart 

Another tip 2 allow many connections
------------------------------------------
To increase the maximum connections that mysql allows, you must edit the file /etc/my.cnf. Log into the server as root and type

nano /etc/MYSQL/my.cnf

it will open the config file (depending upon your cnf file location change the path) and uncomment (remove #) to the following line with the allowed no of connections e.g.
max_connections=10000 
Now press CTRL+X and Yes (Y) to exit from terminal window. Now Type

/etc/init.d/mysql restart 
you will see on the terminal screen
Stopping MySQL database server mysqld: [ OK ]
Starting MySQL database server mysqld: [ OK ]
 
CHECK THE SETTING IS PROPER OR NOT...

If you'd like to check to see if this setting was successfully applied, you may check using one of the following methods: 
  1. login to mysql
    mysql -uadmin -ppassword
    or through mysql administrator tool (Go to tools->MySQL text Console), you will be at the "mysql>" prompt. 
  2. Then give the command
    show variables like 'max_connections'; 
    make sure you put the semi-colon on the end. To exit mysql, use the "quit" command

    .

Monday, July 16, 2012

CAS Jasig in Ubuntu: Login Issue

Case: Cannot login to ldap after done configuration in Tomcat6.

Solution steps:

1. Check tomcat log
    # cd /var/log/tomcat6

    # grep -R 443 *     <- to grep all log related to 443 port

2. Check established port See if port 8443 established?
    # netstat -na

3. Check LDAP log whether CAS listen/connected with LDAP server.
    # tail -f  /var/log/debug.log

4. How to check tomcat root folder ?
    # nano  /etc/init.d/tomcat6

    From this file, you will find that root folder for tomcat in:
    CATALINA_HOME =  /usr/share/tomcat6

5. Check the SSL Cert current location. In my case, the cert located in /root/ folder.
    The cert should move to tomcat root folder : /usr/share/tomcat6


6. Move the SSL cert folder from /root  to   /usr/share/tomcat6/
   # cd  /root/
   # mv cert  
/usr/share/tomcat6/

7. Change ownership for the cert folder
    # cd 
 /usr/share/tomcat6/
    # chown -R  tomcat6:tomcat6  cert



8. Fix the cert path in server.xml configuration file


9. Check the deployerConfigContext.xml  for 'authenticationHandlers' setting:
    For new version of CAS Jasig, the basedn setting look like this:
    **
    
value="cn=%u, ou=people, dc=staff, dc=company, dc=com, dc=my" 
    In our case, we missed the ou object in the property value.

10. Restart Tomcat Server
    # /etc/init.d/tomcat6  restart



11. Test login again & good luck. Its working in my case!


Thank you to sifoo Saufi .... cayalah.. terbukti pemegang CCNA. Arigato...
.