MySQL
Upgrading to Lenny
by gregs on Mar.09, 2010, under *nix, MySQL, apache, debian, linode
It's been while since I attended to my VPS, I decided to spend some time last night upgrading my distribution from Etch to Lenny. This is normally a moment where your heart sinks as quite a few things do tend to go belly up, but I am happy to report that I only came across some minor issues and these were resolved in minutes as opposed to hours.
- MySQL : failed to start, complaining about:
CODE:
-
/etc/init.d/mysql: ERROR: Using expire_logs_days without log_bin crashes
-
the server. See README.Debian.gz
Commenting out the expire_logs_days in the my.cnf file allowed me to restart MySQL.
-
- After the upgrade of Apache, my virtual hosts weren't working. A quick search via Google pointed me to this post - a quick edit of all of my host files and it was all working again.
- the php-mysql connector somehow hadn't been upgraded/installed so a quick
CODE:
-
apt-get install php5-mysql
fixed that problem.
-
- OpenBD : the only thing that remains broken was my tomcat5.5 Open BD install. Tomcat was working fine but Open BD refused to start up complaining about :
CODE:
-
javax.servlet.ServletException: Open BlueDragon Engine Failed to initialise tags: java.awt.Color
Since I am not really using it, it's not that important, but at some stage I'd like to get it working again. If you have any suggestions, please leave a comment.
-
Beyond SQL injection attacks
by gregs on Nov.23, 2006, under MS SQL, MySQL
Courtesy of Slashdot a reminder that you should also worry about other types of injection attacks. Don't you just wish that everybody would play nice?
UPDATE
In a similar vein, Nadav Samet covers off in more detail Cross Site Scripting attacks, how they work and what you can do to protect your site.
AUTO INCREMENT
by gregs on Jun.29, 2006, under MySQL
Since the MySQL Query Browser on my Mac refused to let me set a field as auto increment through the GUI, here's how you can using SQL change an existing column to use auto_increment:
-
ALTER TABLE `aggregatedWeekly` CHANGE `Id` `Id` INT( 6 ) UNSIGNED NOT NULL AUTO_INCREMENT
UPDATE
I have also recently found out that the following works just as well:
Configuring MyODBC on NT
by gregs on Oct.17, 2000, under MySQL
This is effectively part II of configuring MySQL for NT. With the help of this document you will be able to access your MySQL database server from other Windows applications (e.g. Cold Fusion). Right so let's get started. We shall begin with installing MyODBC (a copy of which can be obtained from here http://www.mysql.com/downloads/api-myodbc.html).
Installing MyODBC is straightforward. Unzip the downloaded file and click on the setup.exe file and simply follow the installation prompts. For starters just keep accepting the default settings if you are unsure of any options.
OK, now we are ready to add a MySQL datasource. You have to do this through ODBC datasources in the Control Panel. Please note: if you were planning on using the Cold Fusion Administrator, you can't. You have to go through the Control Panel to initially configure the datasource. Once setup you can modify your MySQL datasources through the Cold Fusion Administrator. So go ahead and fire up your ODBC manager.
Once open, go to the the system DNS tab and select Add.... From the list of available drivers select MySQL and click Finish. This should fire up a dialogue with a whole bunch of fields. Listed below is a sample entry:
-
Windows DNS name: mydsn
-
MySQL host (name or ip): 127.0.0.1
-
MySQL database name: mydatabase
-
User: myusername
-
Password: mypassword
Things to bear in mind are: from my personal experience, I found that it's best to keep windows DSN and database name in lower case. Specifying the IP address works, I have had problems using the host name setting. As for the username and password, make sure that you use those properties that you set to the database you created. I.e. if you don't require a logon to connect to that database, then leave the fields blank. Else enter the username and password assigned to that database (the default root account will work well, but is contentious for security reasons).
Well we are done you should know have configured your system to connect to a MySQL database via ODBC.
Configuring MySQL on NT
by gregs on Oct.17, 2000, under MySQL
In the following I will talk you through setting up MySQL on an NT box and running it as a service. We will also shore up the security a bit, create a database and connect to it. To start it all off you will need the install files you can grab these from the MySQL web site (http://www.mysql.com/. Go to the downloads section and find the relevant compiled files [The last time I looked all I could find where the beta compiled files @ http://www.mysql.com/downloads/mysql-3.23.html]. The source files are usually stored in a Zip archive so you will need to extract them. Once that is done run setup.exe and follow the prompts.
OK so far so good. Now you will need to setup MySQL to run as a service. This is easy just switch to c:\mysql\bin. There you will see a file called mysqld-nt.exe. This is the file that installs MySQL as a service on your NT box. You install the service with the following command:
-
mysqld-nt --install
After a couple of seconds (or less depending on the speed of your machine) the service is installed and you can test the installation (it doesn't tell you if the service has been successfully installed or not) by typing: net start MySQL (incidentally should you wish to stop the server just type net stop MySQL). NT should inform you that the service is starting and whether it has started successfully or not.
On to the next stage. We will now secure the database server a little bit. As per the default installation the Administrator username is root and it has no password set. As you can imagine this is a serious security hazard. So in the following we are going to reset the password, by logging into MySQL (specifically the system database mysql) and removing the default user account, exiting the server reloading it and re-setting the password for root. Simply type the commands in listed below (you can read through the documentation on this subject at http://127.0.0.1/{your SQL documentation mapping}/manual.html#Win32, section 4.12.4):
-
C:\mysql\bin\mysql mysql
-
mysql>; DELETE FROM user WHERE Host='localhost' AND User='';
-
mysql>; QUIT
-
C:\mysql\bin\mysqladmin reload
-
C:\mysql\bin\mysqladmin -u root password{your password}
Next we will test whether your changes were successful, try login back into the database server, from the command prompt type mysql -u root -p mysql this should prompt you for a password. Type in the password you have just specified and you be logged in. Don't log out because we are now going to create another database. The steps syntax is very simple for this. From the MySQL command prompt type: create database <your database name> ;. Now type show databases; and this should provide you with a list of databases available.
Well there you go. You know should be able to install, configure, secure and create a database in MySQL. In the coming days I will try and write up something about installing MyODBC so that you can get other applications (such as Cold Fusion) to talk to MySQL. I hope you found this article useful!
Configuring Cold Fusion and MySQL
by gregs on Oct.17, 2000, under ColdFusion, MySQL, Uncategorized
Configuring Cold Fusion and MySQL
Listed in this document will be a collection of problems I encountered while working with both Cold Fusion and MySQL, and some of the work arounds/solutions I have come across to resolve these problems.
- When planning to store and display large amounts of data in a text field, you have to be aware of a setting in the Cold Fusion Administrator. By default the Long Text Buffer Size is limited to 65,000 characters. As a result should you have more than 65,000 characters to display the excess will be chopped. This problem can be fixed by either increasing the Long Text Buffer Size (better for performance, but still has an impact) or by enabling Long Text Retrieval Settings (can have an impact on performance). These settings can be reached by editing the datasource properties.