Archive for December, 2009

MySQL: “Access denied for user ‘debian-sys-maint’@’localhost’”

with 4 comments

For all you Ubuntu/MySQL developers out there, have you ever seen the following?

    neo@thematrix:~$ sudo /etc/init.d/mysql restart
    * Stopping MySQL database server mysqld [fail]
    * Starting MySQL database server mysqld [ OK ]
    /usr/bin/mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

So, what is this “debian-sys-maint” user?  Well, this MySQL user is created for the Ubuntu to be able to start/stop the database and to carry out other maintenance operations.

Sounds well enough, but then why do I keep running into the “access denied” problem for this user?  Well, the issue is that with each update to MySQL, the user’s password in the database is overwritten.  Ubuntu seems to go to the file /etc/mysql/debian.cnf in order to find this user’s password, but obviously the password is out of sync after the update has been applied.

As a result of this behaviour, I’ll run into the “access denied” problem every so often.  Thankfully, the solution to this issue is fairly simple.

First, list the contents of the /etc/mysql/debian.cnf file:

    neo@thematrix:~$ sudo cat /etc/mysql/debian.cnf

The contents of the file should look something like the following:

    # Automatically generated for Debian scripts. DO NOT TOUCH!
    [client]
    host     = localhost
    user     = debian-sys-maint
    password = n4aSHUP04s1J32X5
    socket   = /var/run/mysqld/mysqld.sock
    [mysql_upgrade]
    user     = debian-sys-maint
    password = n4aSHUP04s1J32X5
    socket   = /var/run/mysqld/mysqld.sock
    basedir  = /usr

See that password?  That’s what we’re looking for!

Next, we want to issue a command to MySQL that tells it to grant the debian-sys-maint user all necessary privileges using the new password.

Login to your mysql server using your root account and the root password you had originally set:

    neo@thematrix:~$ mysql -u root -p

Issue the GRANT command now to grant those permissions:

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'n4aSHUP04s1J32X5';

Voila!  If you restart MySQL, you’ll find that you should no longer be getting the “access denied” error message.

    neo@thematrix:~$ sudo /etc/init.d/mysql restart
    * Stopping MySQL database server mysqld [ OK ]
    * Starting MySQL database server mysqld [ OK ]
    * Checking for corrupt, not cleanly closed and upgrade needing tables.

Bear in mind, because we just switched the password, and the change hasn’t been affected yet, you may need to kill the MySQL server processes in order to get MySQL to shut down at all.

Comments

Check History By TIME

History is a common command for shell to list out all the executed commands. It is very useful when it comes to investigation on what commands was executed that tear down the server. With the help of last command, you be able to track the login time of particular user as well as the the duration of the time he/she stays login.

last
...
mysurface    tty7         :0               Mon Oct  6 20:07 - down   (00:00)
reboot   system boot  2.6.24.4-64.fc8  Mon Oct  6 20:06          (00:00)
mysurface    pts/8        10.168.28.44     Mon Oct  6 17:42 - down   (01:58)
mysurface    pts/7        :0.0             Mon Oct  6 17:41 - 19:40  (01:59)
mysurface    pts/6        :0.0             Mon Oct  6 17:27 - 19:40  (02:13)
mysurface    pts/5        :0.0             Mon Oct  6 17:27 - 19:40  (02:13)
mysurface    pts/5        :0.0             Mon Oct  6 15:52 - 15:59  (00:07)
...

If the command line history could provides the date time of the commands being executed, that may really narrow down the scope of the user actions that cause the server malfunction. By default, history do not append with timestamp, but it is easy to configure it to display timestamp, you just need to set one environment variable HISTTIMEFORMAT.

HISTTIMEFORMAT takes format string of strftime. Check out the strftime manual to choose and construct the timestamp that suit your taste. My favorite is “%F %T “.

export HISTTIMEFORMAT="%F %T "

Execute history again and you will see the effect on the spot, bare in mind that the timestamp for command lines that executed at previous sessions may not valid, as the time was not tracked.

...
994  2008-10-16 02:27:40 exit
995  2008-10-16 01:12:20 iptables -nL
996  2008-10-16 01:47:46 vi .bash_profile
997  2008-10-16 01:47:55 history
998  2008-10-16 01:48:03 . .bash_profile
999  2008-10-16 01:48:04 history
1000  2008-10-16 01:48:09 exit
1001  2008-10-16 02:27:43 history
...

Comments

Debian Resolvconf error

Kalo nemu masalah invoke-rc.d error setelah install aplikasi resolvconf di debian linux…. cara-nya cukup mudah, tinggal menambahkan path pada script…

—-

root@IdeDemo:~# joe /etc/resolvconf/update-libc.d/squid
—-

#!/bin/sh
PATH=/usr/sbin:/sbin:/usr/bin:/bin
# Make squid aware of changes to resolv.conf
invoke-rc.d squid reload || true

Comments

SMS QUERY

Laporan Harian kas bank isi dot php
//
QRY = Pengeluaran kambek penerimaan
Line 182, 207

YLL
$sisaJumlah = $inJmlYbl – $outJmlYbl ;

//SDHI lihat dibawahnya

Comments

Call External Script By Using Trigger on Mysql

You can use ‘\!’ instead of ‘system’. Should work in triggers and SPs.

Example:

CREATE TRIGGER tg1 BEFORE UPDATE ON alarms

FOR EACH ROW

BEGIN

\! echo “I am message from a system call.”;

END $$

Hello,

This is my example. It’s right!

Please, use mysql shell on linux command line (On Windows throw an syntax error):

DELIMITER $$

CREATE TRIGGER tg1 AFTER INSERT ON `your_table`

FOR EACH ROW

BEGIN

\! echo “php algun_script_php.php” >> /log/yourlog.txt

END $$

DELIMITER ;

Please, check rigth permissions for write the file yourlog.txt.

Regards!

Marco 

Comments

Soal Quiz I Prokom

Comments

CDMA –> wvdial.conf

root@ide-makarya:~# cat /etc/wvdial.conf
[Dialer internet]
init1 = ATZ
init2 = AT+CRM=1
Stupid Mode = 1
Phone = #777
SetVolume = 0
FlowControl = Hardware (CRTSTCS)
Inhents = Modem0
Modem = /dev/ttyUSB0
Username = hxjf3mbc@free
Password = telkom
Dial Command = ATDT
Baud = 460800

Comments

Memmory Bekas

DDR 128mb PC2100 Samsung = Rp 28.000

DDR 256mb PC2100 = Rp 55.000
DDR 256mb PC2700 = Rp 60.000
DDR 256mb PC3200 = Rp 65.000
(Samsung, Hynix, mt)

DDR 512mb PC2100 = Rp 130.000
DDR 512mb PC2700 = Rp 135.000
DDR 512mb PC3200 = Rp 140.000
(Samsung, nanya, Mt)

DDR 256mb PC2100 Visipro = Rp 75.000
DDR 512mb PC3200 Visipro = Rp 170.000

*DDR 256/512mb Qty hrg Khusus..

HUb:
031-5914886 / 77812249
081 938 121 123
YM: s3_acc

Comments

sensitive Port… Please di closed

Not shown: 1668 closed ports
PORT     STATE    SERVICE
22/tcp   open     ssh
53/tcp   open     domain
80/tcp   open     http
111/tcp  filtered rpcbind
113/tcp  filtered auth
139/tcp  filtered netbios-ssn
143/tcp  open     imap
826/tcp  filtered unknown
993/tcp  open     imaps
1723/tcp filtered pptp
2049/tcp filtered nfs
3306/tcp open     mysql

Comments

Paket Installasi Server

1. Squid
2. nmap
3. mysql
4. snmpd
5. openssh-server
6. iftop
7. apache2
8. php5
9. mysql
10. Script Firewall

Comments

« Previous entries Next Page » Next Page »