One of the things that I do rarely is creating and configuring a Linux OS and web server for a client. Especially a Virtual Private Server. In the print business most servers are Microsoft Windows machines and I typically find myself doing a lot of these. But a few weeks ago a friend wanted a tester for his new VPS hosting service and I volunteered. But many things that I never encountered before had to be fixed.
Popular just now
-
When dealing with Amazon Web Services using the command line for accessing the file system to configure the server using Putty is OK. But wh...
-
This was making me a little crazy today so I thought I would share. "Manual" PHP 5.5.x with WampServer Installing Windows (War...
-
One of my favorite pastimes is eavesdropping on programmers and developers while riding the commuter trains. You'd be amazed at the stuf...
ad1
Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts
MySQL: Exporting and Importing Stored Procedures
One of my favorite pastimes is eavesdropping on programmers and developers while riding the commuter trains. You'd be amazed at the stuff I hear. Some good ideas are being bandied about but some of them are obviously wrong in thinking or in their research. I became privy to a conversation while over hearing three young professionals discuss PHP and MySQL. It caught my attention because the usual topics are discussed surrounding java or .net. This time a critical decision was made based on errant information. They decided not to use MySQL because it did stored procedures but they would have to be written over and over again. It seems that they did not know that you can in fact export Stored Procedures and Triggers. Having come from SQL Server this was one of the first things I looked for when SPs and Triggers became available in MySQL.
Since version 5 MySQL has stored procedures and triggers. You can backup and restore these function using mysqldump. Mysqldump will by default run all the triggers but leave SPs behind. You can fix this by setting the proper parameters when doing the dump. If you add the --routines command line parameter then you are set:
mysqldump mydatabase -u -p --routines > backup.sql
If you have already backed up everything and are just now reading this. You can grab your SPs with:
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt mydatabase > spbackup.sql
Run the script like normal to restore to the new db:
mysql mynewdatabase < spbackup.sql
This make me wonder why more CMS systems do not use SPs and Triggers rather than creating copies of these functions in PHP.
Since version 5 MySQL has stored procedures and triggers. You can backup and restore these function using mysqldump. Mysqldump will by default run all the triggers but leave SPs behind. You can fix this by setting the proper parameters when doing the dump. If you add the --routines command line parameter then you are set:
mysqldump mydatabase -u -p --routines > backup.sql
If you have already backed up everything and are just now reading this. You can grab your SPs with:
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt mydatabase > spbackup.sql
Run the script like normal to restore to the new db:
mysql mynewdatabase < spbackup.sql
This make me wonder why more CMS systems do not use SPs and Triggers rather than creating copies of these functions in PHP.
More About:
MySQL
Erlang MySQL connection
Starting to collect all I can on using Erlang, Yaws and MySQL Here is a database connection and query for MySQL
application:start(odbc). ConnString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=test; User=root;Password=ace152;Option=3;". {ok, Conn} = odbc:connect(ConnString, []). Results = odbc:sql_query(Conn, "SELECT * FROM test_table").
Now I need to find out how to iterate through records.
application:start(odbc). ConnString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=test; User=root;Password=ace152;Option=3;". {ok, Conn} = odbc:connect(ConnString, []). Results = odbc:sql_query(Conn, "SELECT * FROM test_table").
Now I need to find out how to iterate through records.
Subscribe to:
Posts (Atom)