Import data from Access to MySQL for Drupal content (not CMS data)

If you need to import a table of data from an Access database for use in Drupal, you don't need a module to do that. You can use tools provided by Microsoft and Oracle (i.e., MySQL) for connecting the databases. This looks to me like a better way to go than using a Drupal module because it uses a direct data connection between Access and MySQL with nothing intervening that could introduce a potential for error. But I'm open to being corrected on that if others explain why a certain module is a better way to do this.

Custom query: Delete submission from given date

If you need to remove all data submitted before e.g. Feb 19th 2014, you can use the below query to look up the number of submissions. Replace @nid with the webform’s node id or set @nid with a SET @nid=<nid>; statement. Also don’t forget to edit the date to your needs.

High Performance Drupal

Sub-title: 
Fast and Scalable Designs
Publisher: 
O'Reilly Media
Publication date: 
2013-10
Page count: 
264
ISBN-13: 
978-1449392611

How can you help your Drupal website continue to perform at the highest level as it grows to meet demand? This comprehensive guide provides best practices, examples, and in-depth explanations for solving several performance and scalability issues. You’ll learn how to apply coding and infrastructure techniques to Drupal internals, application performance, databases, web servers, and performance analysis.

Covering Drupal versions 7 and 8, this book is the ideal reference for everything from site deployment to implementing specific technologies such as Varnish, memcache, or Solr. If you have a basic understanding of Drupal and the Linux-Apache-MySQL-PHP (LAMP) stack, you’re ready to get started.

  • Establish a performance baseline and define goals for improvement
  • Optimize your website’s code and front-end performance
  • Get best and worst practices for customizing Drupal core functionality
  • Apply infrastructure design techniques to launch or expand a site
  • Use tools to configure, monitor, and optimize MySQL performance
  • Employ alternative storage and backend search options as your site grows
  • Tune your web servers through httpd and PHP configuration
  • Monitor services and perform load tests to catch problems before they become critical

User warning: Field doesn't have a default value (PDOException: SQLSTATE[HY000]: General error: 1364)

Situation:

Some of the fields in the database lost their default values.

Drupal produces errors like

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'users' doesn't have a default value: INSERT INTO {node} (vid, type, language, title, uid, status, created, changed, promote, sticky) VALUES ...

Solutions:

Fast method

Use a tool like phpmyadmin to assign a default value to the column in question.

Manual Method (45 mins to 1.5 hr)

1. Put your site to offline mode.

2. Backup all your databases and files (Important).

3. Install Drupal (same version) to another fresh database. Do NOT uninstall your existing site.

4. Enable the same modules (same version). Run update.php.

5. Open phpMyAdmin and select the new Drupal database.

6. Open phpMyAdmin and select the faulty Drupal database.

7. Select a table (same name in the new database and faulty database).

8. Select 'Structure' tab (on both sides).

9. Compare the 'Name' and 'Default' columns. Pay attention to blanks (in the new database) and 'None' (in the faulty database).

10. If you see any difference in 'Default' values, select 'Change' (Pencil icon) on the faulty database. If no difference, proceed to step 7 or 14.

11. Under 'Default', select 'As defined:'.

12. Select 'Save'.

Use MySQL to store DLR information

You need to use MySQL to store DLR information. Enable it on /etc/kannel.conf:

#­­­ mysql connection
group = mysql­connection
id = mydlr
host = localhost
username = root
password = ******
database = dlr
max­connections = 1

#­­­­ DLR table structure
group = dlr­db
id = mydlr
table = dlr
field­smsc = smsc
field­timestamp = ts
field­destination = destination
field­source = source
field­service = service
field­url = url
field­mask = mask
field­status = status
field­boxc­id = boxc

Use PHPMyAdmin to create database: dlr.

Drush SQL Query (sql-query, sqlq)

Below you find some examples of how to use the Drush sql-query (alias : sqlq) command.

Show information of user 1:
drush sql-query "SELECT * FROM users where uid=1"

Troubleshooting

error: system() has been disabled for security reasons

To resolve, go to your (local or global) php.ini and temporarily remove 'system' from the disable functions parameter:

Example:

Change
disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, shell, symlink
To:
disable_functions = show_source, shell_exec, passthru, exec, phpinfo, shell, symlink

Warning: this exposes some security risks, so there must be a better way to do it with PHP, without using the 'system()' function.

Using a custom php.ini
Please see the page Modifying the PHP or PHP configuration that drush runs under for instructions on creating a custom php.ini file for Drush.

Custom version of the php.ini file

You can use something like this to invoke a custom version of the php.ini file you want to use with Drush. The PHP command argument -c ini-file will allow you to specify a custom .ini file to use with Drush.

Pages

Subscribe with RSS Subscribe to RSS - mysql