• Home
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
  • CMS
    • Magento
    • Yahoo! Store

Recover MySQL root password with root access

Sunday, 31 January 2016 17:12
Tim Ramsey
0 Comments
There are times when you lose root mysql password, but you still have root access to the server. You will probably get an error something like this:
mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'
Reset it with the following steps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Stop mysql service
/etc/init.d/mysql stop
 
#Start the MySQL server w/o password
mysqld_safe --skip-grant-tables &
 
#Connect to the MySQL server without password
mysql -u root
 
#Set a new MySQL root user password
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
 
#Stop mysql service
/etc/init.d/mysql stop
 
#Start mysql service
/etc/init.d/mysql start
 
#now you can login with password
mysql -u root -p

Useful SSH commands for access issues and Keys

Thursday, 14 January 2016 13:44
Tim Ramsey
0 Comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#How to block an IP using iptables?
iptables -A INPUT -s xx.xx.xx.xx -j DROP
 
#How to block an IP for a specific port:
iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP
 
#How to allow access to an IP?
iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT
 
#How to allow access to an IP to a specific port using iptables?
iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT
 
#See if SSHD is running and listen to port
netstat -tlpn
 
mkdir .ssh
chmod 700 .ssh
nano .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
 
#restart ssh ubuntu
/etc/init.d/ssh

Load custom php.ini with CRON job

Friday, 13 February 2015 14:46
Tim Ramsey
0 Comments
Live and learn. I didn’t realize that when a cron job runs, it does not load the site php.ini file, but by adding a custom directive, we can tell the the php cron job to load the file.
1
php -c /home/username/config/php.ini /home/username/script.php
The error I was receiving is below even though I had allow_url_fopen enabled:
Warning: simplexml_load_file(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/username/script.php on line 12
Adding the custom directive resolved the issue and hopefully will for you too.

How to duplicate | copy a Magento Database with SSH

Tuesday, 30 December 2014 22:41
Tim Ramsey
0 Comments
I was a bit hopeful with phpMyAdmin “Synchronize”, but Magento’s databases are apparently too big for it because I ended up with white screens and partial uploads.  I resorted to using SSH and doing it over command line.  Two lines of code and you can export from your live database and import into a production database.  Here you go. Export
1
mysqldump -u username -p database_name > dump.sql
  Import
1
mysql -u username -p target_database_name < dump.sql
Hopefully saved you some time and frustration 🙂

Page 12 of 15

  • Previous
  • 1
  • …
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • Next

Categories

  • CMS
    • Magento
    • Shopify
    • Yahoo! Store
  • Programming
    • API
      • Google
    • Javascript
    • Php
    • Server
    • SVN
  • VOIP

Recent Posts

  • How to write to Google Sheet with API in PHP
  • How to Migrate FreePBX server to a new server
  • Unifi Controller Java CPU 100%
  • Update Unifi Controller on Linux
  • Code Signing Desktop App