Exporting select result from MySQL and getting the error ‘ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option’

To use ‘select … into outfile’ on MySQL the user needs to have the FILE permission as described here.

Even with this privilege however, if there server is running with the –secure-file-priv option you’ll see this error:

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option

When this option is enabled there’s usually one or more paths by default that are configured that you can import and export to. You can find these paths using:

mysql> SHOW VARIABLES LIKE "secure_file_priv";

+------------------+-----------------------+

| Variable_name    | Value                 |

+------------------+-----------------------+

| secure_file_priv | /var/lib/mysql-files/ |

+------------------+-----------------------+

1 row in set (0.02 sec)

Knowing where our trusted location is for importing/exporting, lets try again:

select examplecol from exampletable 
order by createdate desc limit 1 
into outfile '/var/lib/mysql-files/mysqlout.txt';

Success!

This is discussed in answer to this question here.

Testing apps using AWS DynamoDB locally with the AWS CLI and JavaScript AWS SDK

One challenge when developing and testing code locally before you deploy is how you test against resources that are provisioned in the cloud. You can point directly to your cloud resources, but in some cases it’s easier if you can run and test code locally before you deploy.

DynamoDB has a local runtime that you can download and run locally from here.

Once downloaded run with:

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

You can use the AWS CLI to execute any of the DynamoDB commands against your local db by passing the –endpoint-url option like this:

aws dynamodb list-tables --endpoint-url http://localhost:8000

Docs for the available DynamoDB commands are here.

Other useful cli commands (append–endpoint-url http://localhost:8000 to use the local db):

List all tables:

aws dynamodb list-tables 

Delete a table:

aws dynamodb delete-table --table-name tablename

Scan a table (with no criteria)

aws dynamodb scan --table-name tablename

 

Running AWS Lambda functions on a timed schedule

AWS Lambdas can be called directly or triggered to execute based on a configured event. If you take a look at the ‘CloudWatch Events’ section, there is a configuration option for a Rule that can take a cron expression to trigger a Lambda based on a timed schedule. This could be useful for scheduling maintenance tasks or anything that needs to run on a periodic basis:

Scroll down to the ‘Configure trigger’ section and you’ll see the ‘Schedule Expression’ field where you can enter an expression like ‘rate(x minutes)’ (there’s a typo in the screenshot below it should be ‘minutes’ not ‘minute’) or define a cron style pattern:

Scroll further down and there’s an option to enable the schedule rule straight away, or disable it for testing, and you can enable it when you ready to start the schedule later:

After you’ve created the Rule, if you need to edit it you’ll find it over in the CloudWatch console page, under Events / Rules:

Update: Java 10 with Eclipse Oxygen 3a (4.7.3a RC2) – working!

Following up on responses to my tweet and post yesterday, here’s a summary of the suggestions to get Java 10 support working with Eclipse 4.7.3a RC1:

  1. Download the 4.7.3a RC1 build. Yesterday I had tried the 4.7.3a M20180322-1835 build as stated on the previously available Java 10 support plugin:

but the recommendation from Noopur Gupta was to download the 4.7.3a RC1 release which looks like it’s after the M20180322 release, and this apparently has specific support for the new var keyword:

2. Ensure have the latest Maven m2e plugin for Maven support is installed:

3. Configure Maven pom.xml with the maven-compiler-plugin v3.7.0 and set the source and target versions to 10. Instead of setting the source and compile version in properties like this:

  <properties>
    <maven.compiler.source>10</maven.compiler.source>
    <maven.compiler.target>10</maven.compiler.target>
  </properties>

This tweet shows setting the 10 value as a <release> property:

So replacing the source and target properties that I normally use, and using this:

  <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.7.0</version>
         <configuration>
         <release>10</release>
         </configuration>
       </plugin>
     </plugins>
  </build>

Now doing a Maven Update on my project, and what do you know, now it’s switched to Java 10:

And here it it, the var keyword in all it’s glory:

Thanks for everyone’s tips and suggestions to get this working!