Thursday, 31 January 2008
fedora yum mysql install guide
First thing's first, you need to download and install mysql with the following command;
#> yum install mysql mysql-server mysql-devel
Next, open up your firewall on port 3306 - that's the port external connections (like mysql administrator) use to interact with the database.
#> vi /etc/sysconfig/iptables
Press i (to enter insert mode) and add these lines in an appropriate place;
-A RH-Firewall-1-INPUT -p tcp -m state -m tcp --dport 3306 --state NEW -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m state -m udp --dport 3306 --state NEW -j ACCEPT
Press esc to stop insert mode.
Type :wq
Next restart your firewall for the settings to take effect;
#> service iptables restart
Now navigate to the default mysql-server document directory, and edit the example large confige file for mysql;
#> cd /usr/share/doc/mysql-server-*/
#> vi my-large.cnf
Press esc
Type :w!/etc/my.cnf
Type :q
You have now overwritten your basic configuration file for mysql server. Once you have restarted the mysqld service (using #> service mysqld restart), these settings should now take effect and you should have the mysql service listening on port 3306.
However, you still require a mysql database user who can access the database from an external computer (using mysql administrator) and you also need to set your root password. For the sake of simplicity and to get you connected, i'm going to use the root user in mysql, however I would recomend you use different users to manage your server for security reasons.
Anyway, here's how to set the root password;
#> mysql -u root
use mysql
update user set Password=PASSWORD('yourpassword') where User like '%root%';
quit
Finally, restart the mysql service, for everything to take effect;
#> service mysqld restart
Voila, a workin mysql server which you can connect from external computers to port 3306 on your server.
Tuesday, 20 November 2007
Windows 2003 Shutdown Restart Command with Examples
Well here are a couple of examples that do shutdown or restart the Server;
Shutdown Windows 2003
- SHUTDOWN /s /d P:2:17
Restart Windows 2003
- SHUTDOWN /r /d P:2:17
These two commands appear to work for me. visit this link (http://www.ss64.com/nt/shutdown.html) for further information.
Saturday, 29 September 2007
ie css bug fixes
IE Position, Stretch or Browser Resize Problem
IE stretches too wide or after the browser is resized, ie doesn't reposition elements correctly.
ie fix
Apply position:relative to the body tag, the element and containing elements, which are effected by the bug. e.g. in your css file addbody,
#element_container,
#element{position:relative;}
You may also have to play around with width but the above code should work a treat!
IE White Space Bug
This usually occurs when you've been floating elements around each other. This manifests itself in in ie either as a big line space appears at the bottom of the elements or the elements don't stretch the page relative to each other.IE White Space Fix
at the bottom of the elements, add a new block element like a paragraph tag with a style of clear:both; e.g.
You may also need to adjust the height, line height and the font size so the block element doesn't appear as a new line, e.g.;
Thursday, 30 August 2007
MySQL Password Reset Root
If you're reading this - chances are, you're an idiot. I know this as I am also an idiot as I installed a development server recently and forgot the root password for mysql. Yes I should have written the password down, no I didn't. here's the steps for resetting the root password on a working linux server;
1.) First login as root via ssh
2.) kill the mysqld service and all other mysql running processes e.g.
#> service mysqld stop
#> ps waux
ps waux gets a list of all running processes
use kill to stop any running mysql processes eg kill 6194 (kill pid).
3.) After stopping/killing mysqld, run the foillowing line;
#> mysqld_safe --skip-grant-tables &
4.) You are now logged into mysql safe mode. Cut and paste the following lines
mysql -u root mysql
UPDATE user SET password=PASSWORD("your_password") WHERE User="root";
FLUSH PRIVILEGES;
exit;
5.) then start up the mysqld service;
#> service mysqld start
That's it - all done. Now remember to write down ur password this time u idiot!
Tuesday, 28 August 2007
SELinux CURL Problem
skip to solution
Recently, I made a recursive xml sitemap generator tool, which quickly generates a sitemap, calculating how popular certain pages are related to how may linke they have internally. This helps make quick, good xml sitemaps that google likes as it follows the rough popularity that google sees of each page.
So I spent about 3 hours on this script - making it proper kick ass only to discover that when I upload the script from my dev server to my live server - the fucker doesn't work! not only that, but there's nothing reported in /var/log/messages.
After updating php-curl using yum and turning my firewall off with still no luck - I decided to get heavy handed and ask my server people to reinstall a newer version of fedora.
so afterspending another half a day setting up ftp/httpd/iptables/mysql/php/bind/etc. I uploaded the xmlsitemap generator and it still doesn't fucking work!
Oh where do I start? 'Livid' doesn't even come close - not only had i wasted the best part of a day updating my server - I didn't even manage to fix my sitemap script!!!
However, i did now have a message in /var/log/messages;
comm="httpd" dest=80 scontext=root:system_r:httpd_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket
After much googling, I found this solution;
Solution
in the cli, type the following
#> getsebool -a
#> setsebool httpd_can_network_connect true
The first command displays the current SELinux settings, the second should change the SELinux setting so that httpd can access tinterweb.
I think this is one of thise annoying SELinux bugs that no-one really understands as there's not much on google about it - however i've found loads of people moaning about it and not getting it to work. Therefore I hope this helps someone!
Saturday, 11 August 2007
Vi Search and Replace
I use vi as a text editor and I thought I'd add this example fo search and replace using vi;
:1,$s/sometexttoreplace/newtext
In the above example, 1 represents the first line, $s represents the end line.
One important thing to note is that you need to escape any characters like dots, for example;
:1,$s/suffolkweb-design\.co\.uk/suffolk-web-design\.com
would be the way you change domain names from suffolk-web-design.co.uk to suffolk-web-design.com
Wednesday, 8 August 2007
Fedora Startup Scripts
After a bit of fiddling around, I found what appears to be the best solution for me, using ntsysv and init.d. Here's how it's done;
1.) make a new file in the /etc/init.d/ directory
2.) add your script to this file with the following lines at the top;
#!/bin/bash
# chkconfig: 345 85 15
# description: of your file
3.) enter this in the shell;
chkconfig --add startup_filename
4.) type ntsysv - your startup script should now be in the list, checked and ready for action!
It's that easy!