Friday, July 9, 2010

Zimbra - Administrator link

How to log into administrator right:

https://host.ip.adress:7071/zimbraAdmin/

Troubleshooting MYSQL : Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

1. maybe lost mysql.sock file

You need to give the mysql group ownership of the /var/lib/mysql directory.

#> chown -R mysql:mysql /var/lib/mysql

If you lost your mysql.sock file just make a symlink to the file:

# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

ref: http://answers.yahoo.com/question/index?qid=20080704165734AAG757T


2. When connecting to a MySQL server located on the local system, the mysql client connects thorugh a local file called a socket instead of connecting to the localhost loopback address 127.0.0.1. For the mysql client, the default location of this socket file is /tmp/mysql.sock. However, for a variety of reasons, many MySQL installations place this socket file somewhere else like /var/lib/mysql/mysql.sock.

While it is possible to make this work by specifying the socket file directly in the mysql client command

mysql --socket=/var/lib/mysql/mysql.sock ...

it is painful to type this in every time. If you must do so this way (because you don’t have permissions to the file in the solution below), you could create an alias in your shell to make this work (like alias mysql=”mysql –socket=/var/lib/mysql/mysql.sock” depending on your shell).

To make your life easier, you can make a simple change to the MySQL configuration file /etc/my.cnf that will permanently set the socket file used by the mysql client. After making a backup copy of /etc/my.cnf, open it in your favorite editor. The file is divided into sections such as
[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/usr/local/mysql

If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:

[client]
socket=/var/lib/mysql/mysql.sock

If there is already a [client] section in the my.cnf file, add or edit the socket line as appropriate. You won’t need to restart your server or any other processes. Subsequent uses of the mysql client will use the proper socket file.

ref: http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/


3. Okay, so let's answer to this question, once for all.

First of all, you DO NOT WANT to recreate mysql.sock,
that logically makes NO sense at all.

What you REALLY want to do is restart the mysql daemon (mysqld),
which when it is up and running will create a socket for you,
so you can communicate with it.

- Creating a file by hand won't help
- Creating a socket by hand won't help
- None of these "can talk" to the server which is "not running".

The reason why you "lost mysql.sock" is that:
- the mysqld daemon stop or crashed
- a fatal error occurred
- your configuration is wrong /etc/my.cnf
- your permissions are wrong /var/lib/mysql and /var/lib/mysql/mysql ...
=> make sure the owner is mysql:mysql and 775 or similar.
- your mysql data is corrupted: myisamcheck or mysql_install_db

Now, you may say, hey but I tried:
- /etc/init.d/mysqld restart
- /etc/init.d/mysqld start
- mysqld_safe --user=mysql &

and none of those worked...

That's sort of normal, if the server crashed in the first place.

So, what you REALLY need to do is look at the file located in:
/var/log/mysqld.log

like this:
tail -f /var/log/mysqld.log
or
cat /var/log/mysqld.log

figure out the error message, solve that error message
or try to find a work-around for that error on google.

Once that error message is "solved", then you can safely restart mysqld
[no need to reboot], and once the daemon is up and running,
your magical "mysql.sock" file will appear as it did before. =)

The big problem with this is that the "mysql.sock" error message
is not helping at all, and you must "know" that the real error message
is in the mysql log file that's all.

Hope this help.

ref: http://www.linuxforums.org/forum/servers/1451-what-mysql-sock-file-2.html

4. Only delete de log files ib_logfile0, ib_logfile1 and ibdata1 in the /var/lib/mysql directory and then type:

"mysqld_safe --user=mysql &"

and automatically the mysql.sock file will be create and the news logs files.

Wow!!! Do not this if you are using InnoDB as db. Then you'll loose a lot of information. Deleting those files that is.

ref : http://www.linuxforums.org/forum/servers/1451-what-mysql-sock-file.html

5. For self-installed MySQL

If you have downloaded and installed MySQL yourself but are using the pre-installed version of PHP, note that your custom version of MySQL might be configured to use the old MySQL socket location, /tmp/mysql.sock. The version of PHP in this software update uses the newer location /var/mysql/mysql.sock by default.

Therefore, if your PHP scripts are failing to connect to your custom installation of MySQL, this is a likely cause. To correct this, you can modify the PHP configuration file to use the old MySQL socket location:

1. Create /etc/php.ini if it is not present. (You can do so by copying /etc/php.ini.default to /etc/php.ini).
2. Edit the /etc/phi.ini config file, find the [MySQL] section, and change this line:

mysql.default_socket = /var/mysql/mysql.sock

To:

mysql.default_socket = /tmp/mysql.sock

3. Restart the web server to pick up the new PHP settings. It should not be necessary to restart MySQL.

If you subsequently decide to use the version of MySQL that is pre-installed with Mac OS X Server, which uses /var/mysql/mysql.sock, you'll want to either remove that line from /etc/php.ini, or change it back.

ref: http://support.apple.com/kb/HT3077?viewlocale=en_US


6. Since its a prod DB, I need to do this sometime tonight. I will try >su
> cd /etc/init.d
>./mysql stop
>./mysql start

Apart from:
chmod 755

Have you checked that the files are owned by mysql?

Otherwise you should run:
chown -R mysql /your/mysql/datadir

ref : http://forum.percona.com/index.php/m/4324/

MySQL - Import/Export Large MYSQL Databases

When working with MYSQL I often use phpMyAdmin, which is a nice GUI way to manipulate my database. But some operations won't work in phpMyAdmin when the database is too large. In particular, you can't import or export really large databases using phpMyAdmin. So sometimes you need to do things on the command line.

So I thought I'd document some of the command line snippets we use frequently.
In the following, replace
[USERNAME] with your mysql username,
[DBNAME] with your database name,
[/path_to_file/DBNAME] with the path and name of the file used for the database dump, and
[/path_to_mysql/] with the path to mysql bin (like /Applications/MAMP/Library/bin/).


Copy/Export a Large Database

 
MYSQL has no 'Copy' function. You create a copy by dumping the database with mysqldump. To dump the database and gzip it at the same time, use the following. This will prompt you for your password.

 
mysqldump -u [USERNAME] -p [DBNAME] | gzip > [/path_to_file/DBNAME].sql.gz

Import a Large Database
  
If you want to replace the database with a fresh dump created by the above process, do the following.
First, unzip the file.

 
gzip -d [/path_to_file/DBNAME].sql.gz

Get to a mysql prompt (you will be asked for your password.)

 
[/path_to_mysql/]mysql -u [USERNAME] -p

Then do the following to wipe out the old database and replace it with the new dump:

 
SHOW DATABASES;
DROP DATABASE [DBNAME];
CREATE DATABASE [DBNAME];
USE [DBNAME];
SOURCE [/path_to_file/DBNAME].sql;

Conditional Dumps
 
Sometimes the search index is huge and you want to omit it from the dump. Do so with:

 
mysqldump -u [USERNAME] -p [DBNAME] --ignore-table=[DBNAME].search_index | gzip > [/path_to_file/DBNAME].sql.gz

There are actually a number of tables you could exclude, like the sessions table, the watchdog table and all the cache* tables.

But if you use the above technique to destroy and recreate the database after doing this, you will be missing all those excluded tables. So you will want to do a two step process instead:

First, create a backup with ONLY the table information, no data.

mysqldump -u [USERNAME] -p [DBNAME] --no-data | gzip > [/path_to_file/DBNAME].info.sql.gz

Then create a backup, including only data from the tables you need.

 
[path_to_mysql/]mysqldump -u [USERNAME] -p [DBNAME]  --no-create-info --ignore-table=[DBNAME].search_index --ignore-table=[DBNAME].cache --ignore-table=[DBNAME].cache_block --ignore-table=[DBNAME].cache_content --ignore-table=[DBNAME].cache_filter --ignore-table=[DBNAME].cache_form --ignore-table=[DBNAME].cache_menu --ignore-table=[DBNAME].cache_mollom --ignore-table=[DBNAME].cache_page --ignore-table=[DBNAME].cache_pathdst --ignore-table=[DBNAME].cache_pathsrc --ignore-table=[DBNAME].cache_views | gzip > [/path_to_file/DBNAME].data.sql.gz;

Well that's a lot of typing. Wouldn't it be nice if there was a wildcard we could use instead of typing out all those cache_ tables? Well there is!! You can do:

 
[path_to_mysql/]mysqldump -u [USERNAME] -p [DBNAME]  --no-create-info --ignore-table=[DBNAME].search_index --ignore-table=[DBNAME].cache% | gzip > [/path_to_file/DBNAME].data.sql.gz;

After doing this, just import the two files as above, first the one with only the table info, and then the data. Result, a (relatively) small database with all the optional tables emptied out.

Note that the wildcard trick above is not documented anywhere that I can see, so you'll want to test that it works in your setup.

Ref.: Thanks toKaren Stevenson

http://www.lullabot.com/blog/importexport-large-mysql-databases

Thursday, July 8, 2010

Server - BgInfo v4.16

Introduction

How many times have you walked up to a system in your office and needed to click through several diagnostic windows to remind yourself of important aspects of its configuration, such as its name, IP address, or operating system version If you manage multiple computers you probably need BGInfo. It automatically displays relevant information about a Windows computer on the desktop's background, such as the computer name, IP address, service pack version, and more. You can edit any field as well as the font and background colors, and can place it in your startup folder so that it runs every boot, or even configure it to display as the background for the logon screen.
Because BGInfo simply writes a new desktop bitmap and exits you don't have to worry about it consuming system resources or interfering with other applications.

Sysinternals BgInfo



Installation and Use

See Mark's Windows IT Pro MagazinePower Tools article for a primer on using BgInfo. If you have questions or problems, please visit the Sysinternals BgInfo Forum.

By placing BGInfo in your Startup folder, you can ensure that the system information being displayed is up to date each time you boot. Once you've settled on the information to be displayed, use the command-line option /timer:0 to update the display without showing the dialog box.

You can also use the Windows Scheduler to run BGInfo on a regular basis to ensure long-running systems are kept up to date.

If you create a BGInfo configuration file (using the File|Save Settings menu item) you can automatically import and use those settings on other systems by adding the /I or /iq command line option.


Using BgInfo

When you run BGInfo it shows you the appearance and content of its default desktop background. If left untouched it will automatically apply these settings and exit after its 10 second count-down timer expires.
Selecting any button or menu item will disable the timer, allowing you to customize the layout and content of the background information.

If you want BGInfo to edit or use a configuration stored in a file (instead of the default configuration which is stored in the registry) specify the name of the file on the command line:

BGInfo MyConfig.bgi

Appearance Buttons

Fields: Selects what information appears on the desktop, and the order in which it is displayed. For networking fields (NIC, IP, MAC, etc.) a separate entry is created for each network card on the system. Use the Custom button to add special information you define yourself.

Background: Selects the color and/or wallpaper to use for the background. If you select the Copy existing settings option then BGInfo will use whatever information is currently selected by the logged on user. This option allows end users to personalize their desktop while still displaying the BGInfo information.

Position: Selects the location on the screen at which to place the text. If some items are very long (for example some network card names) you can use the Limit Lines to item to wrap them. The Compensate for Taskbar position checkbox adjusts the position of the text to ensure that it is not covered by the Taskbar. The Multiple Monitor Configuration button allows you to specify how multiple monitors attached to a single console should be handled.

Desktops: Selects which desktops are updated when the configuration is applied. By default only the User Desktop wallpaper is changed. Enabling the Logon Desktop for Console users option specifies that the wallpaper should be displayed on the logon desktop that is presented before anyone has logged onto the system. On Windows 95/98/ME systems the same desktop is used for users and the login screen, so this option has no effect. Enabling the Logon Desktop for Terminal Services users option specifies that the wallpaper should be displayed on the Terminal Services login screen. This option is useful only on servers running Terminal Services.

Preview: Displays the background as it will appear when applied to your system.

Configuration Menu Items

These are options that control how the bitmap is produced, where it is located and how to import/export settings.
File | Open: Opens a BGInfo configuration file.

File | Save As: Saves a copy of the current BGInfo configuration to a new file. Once created, you can have BGInfo use the file later by simply specifying it on the command line, or by using File|Open menu option.

File|Reset Default Settings: Removes all configuration information and resets BGInfo to its default (install-time) state. Use this if you can't determine how to undo a change, or if BGInfo becomes confused about the current state of the bitmap.

File|Database: Specifies a .XLS, .MDB or .TXT file or a connection string to an SQL database that BGInfo should use to store the information it generates. Use this to collect a history of one or more systems on your network. You must ensure that all systems that access the file have the same version of MDAC and JET database support installed. It is recommended you use at least MDAC 2.5 and JET 4.0. If specifying an XLS file the file must already exist.

If you prefer to have BGInfo update the database without modifying the user's wallpaper you can unselect all desktops in the Desktops dialog; BGInfo will still update the database.

Bitmap|256 Colors: Limits the bitmap to 256 colors. This option produces a smaller bitmap.

Bitmap|High Color/True Color: Creates a 16-bit or 24-bit color bitmap.

Bitmap|Match Display: Creates a bitmap with color depth matching that of the display. Because the bitmap generated by BGInfo is not updated when a user changes the display's color depth you may see unexpected results (especially dithering of the text and background) with some combinations of bitmap and display depth.

Bitmap|Location: Specifies the location to place the output bitmap file. On Terminal Services servers the bitmap should be placed in a location that is unique to each user.

Edit|Insert Image: Allows you to insert a bitmap image into the output. Because BGInfo's configuration information is stored in the registry and Windows limits the size of registry values you may encounter errors when inserting larger images. On Windows 9x/Me systems the limit is 16K, while on NT/2000/XP systems the limit is 64K.

Command Line Options

       Specifies the name of a configuration file to use for the current session. Changes to the configuration are automatically saved back to the file when OK or Apply is pressed. If this parameter is not present BGInfo uses the default configuration information which is stored in the registry under the current user ("HKEY_CURRENT_USER\Software\Winternals\BGInfo").
/timerSpecifies the timeout value for the countdown timer, in seconds. Specifying zero will update the display without displaying the configuration dialog. Specifying 300 seconds or longer disables the timer altogether.
/popupCauses BGInfo to create a popup window containing the configured information without updating the desktop. The information is formatted exactly as it would if displayed on the desktop, but resides in a fitted window instead. When using this option the history database is not updated.
/silentSuppresses error messages.
/taskbarCauses BGInfo to place an icon in the taskbar's status area without updating the desktop. Clicking the icon causes the configured information to appear in a popup window. When using this option the history database is not updated.
/allSpecifies that BGInfo should change the wallpaper for any and all users currently logged in to the system. This option is useful within a Terminal Services environment, or when BGInfo is scheduled to run periodically on a system used by more than one person (see Using a Schedule below).
/logCauses BGInfo to write errors to the specified log file instead of generating a warning dialog box. This is useful for tracking down errors that occur when BGInfo is run under the scheduler.
/rtfCauses BGInfo to write its output text to an RTF file. All formatting information and colors are included.



Run BgInfo now from Live.Sysinternals.com
Ref : http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx

Server - how to kill open sessions? "Terminal Server Has Exceeded the Maximum Number of Allowed Connections"

When you RDC (connecting remotely using Remote Desktop Connection) to a server and get “Terminal server has exceeded maximum number of allowed connection” message there’s still light at the end of the tunnel.

Tested solution.

RDC to another server in the same workgroup as the one you cannot access and go to Administrative Tools / Terminal Services Manager.


terminal services manager 350x236 Terminal server has exceeded 
maximum number of allowed connection   how to kill open sessions?


From the menu select Actions / Connet to Computer… and provide the name of the server you couldn’t reach. Press OK and you will see open sessions on that server – users who logged in but for some reason haven’t logged out. Right click on the desired user and choose Log Off.


That should solve the case.

Ref : http://dobrzanski.net/2009/05/29/terminal-server-exceeded-maximum-number-allowed-connection-kill-open-sessions/

Server - Command Line Hack for: "Terminal Server Has Exceeded the Maximum Number of Allowed Connections"

If you’ve worked on a network with Windows servers, you’ve encountered this error message at least 37,000 times:

“The terminal server has exceeded the maximum number of allowed connections. The system can not log you on. The system has reached its licensed logon limit. Please try again later.”

This problem happens because Windows only allows two remote terminal services connections when you are in administrative mode, and you’ve either got two people already on that server, or more likely, you’ve got a disconnected session that still thinks it is active.
 
The problem with this error is that you have to actually get on the server console to fix the problem if the server isn’t in a domain. (If you are in a domain, then just open Terminal Services Manager and log off or disconnect the sessions)



To use the command line hacks, you might need to run them from another server if your local operating system doesn’t include the commands. You will also need to make sure that you are logged onto that server with an administrative account. The easiest way to do that is just map a drive (you don’t have to use a drive letter unless you choose to)
net use /user:[username] \\servername\share
Here’s a command line hack that you can use to figure out what sessions are connected to the server. Note that you could substitute the IP address for the server name.
query session /server:servername
Sample output:


Now we know that the session ID of the offending session is 2. We can use that in the next step, which is using the reset command to log off that user.
reset session [ID] /server:servername
Sample:



This command won’t display any output, but when we run the query command again, we should see that the session has now been disconnected:



 

Ref : http://www.howtogeek.com/howto/windows/command-line-hack-for-terminal-server-has-exceeded-the-maximum-number-of-allowed-connections/

Monday, July 5, 2010

Support : How to edit PDF files

Tweak PDF To Word 3.0 is a little program to convert PDF to editable Word for easier editing. The converter enjoys an exact conversion with the output Word retaining intact of all the original features of the PDF, including layout, image positioning, text font, graphics, hyperlinks, etc. Encrypted PDF files can be converted to Word, too.

http://www.tweakpdf.com

To do so quickly, click http://www.onlinedocumentconversion.com upload your document and convert to .doc or RTF & then edit!


Always keep in mind that PDF files are an accurate representation of a document. They are meant for output or on-screen viewing. They are not intended to be intermediate files that can still be edited. There are programs on the market that allow you to change the content of a PDF file and there are applications or plug-ins that can extract the content of a PDF so that you can insert this data into a new document. Altering PDF files is a last resort – whenever possible the original source file should be corrected and a new PDF generated. This is especially true for documents that will be reused at a later date!


The PDF standard supports an extensive set of security features to prevent users from accessing certain features of a PDF file. One of these is the ability to edit PDF files. When you get such a protected file, the correct procedure is obviously to contact its creator and ask for the password to unlock the file. Unfortunately it is sometimes difficult to contact that person or agency or even impossible to find out who locked the file. There are a couple of alternative solutions:

  • The ColorSync utility that was included in OS X releases before version 10.5 overwrites PDF password protection. Simply open the PDF using it and do a ‘Save As’.
  • PDFkey Pro is a commercial multi-platform tool that can remove the password protection from a PDF file. Another option for Windows users is Jkwebtalks’ Free PDF Unlocker.