How to enable remote connections to MySQL server

When you install MySQL, remote connections are disabled by default for security reasons.

You can enable remote connections by changing configuration options in config file.

Edit my.cnf configuration file. On Debian based distributions (also includes Raspbian, which is what I’m using), config file is located in /etc/mysql/my.cnf.

sudo pico /etc/mysql/my.cnf

Once config file is open, find section [mysqld]. Under that section you’ll need to set bind address (which by default should be set to 127.0.0.1) to your server’s IP address. You can also bind to 0.0.0.0 if you don’t wish to specify IP address – useful if machine on which MySQL is hosted has dynamically allocated IP address. You’ll also need to comment out or remove skip-networking line if its in the config file.

So if the machine on which MySQL is hosted has an IP address of 192.168.1.115, configuration options need to look like:

[mysqld]
bind-address 192.168.1.115
#skip-networking

Or if you don’t want to specify IP address:

[mysqld]
bind-address 0.0.0.0
#skip-networking

Leave rest of the configuration file as is and save your changes. Restart MySQL for changes to take effect.

Once this is done, you’ll need to enable users to connect remotely – this is done by creating user account(s) with “From Host” option set to specific IP address from which user is going to connect, or setting “From Host” to “%” value which will accept connection from any host for that username.

For more information on user administration, look at MySQL Manual – Users and Privileges or MySQL Manual – Adding User Accounts.

How to get last day of the month in T-SQL

If you need to get last day of the month (current month or any other) on SQL Server, use in-built function EOMONTH.

SELECT EOMONTH(GETDATE())

SELECT EOMONTH('2011-06-11')

In examples above, first select statement will give you current month’s last day, and second statement will give you last day of July in 2011.

You can then combine this with DATENAME function to get day of the week name.

SELECT DATENAME(dw, EOMONTH(GETDATE()))

SELECT DATENAME(dw, EOMONTH('2011-06-11'))

First select statement returns Saturday as last day of the current month, and second statement returns Thursday as last day of the July 2011.

Further reading:

EOMONTH on MSDN

DATENAME on MSDN

How to enable Dashboard in OS X El Capitan

Apple has disabled Dashboard by default in OS X El Capitan.

To enable it, go to System Preferences -> Mission Control and change Dashboard to “As Space” or “Overlay”. As Space setting makes Dashboard function in the same way as in previous versions of OS X (as another desktop), and Overlay setting displays Dashboard over your current desktop. You can also assign function key which brings up the Dashboard.

Dashboard

Windows 10 thrashing your hard drive? Turn off scheduled drive optimization

One thing that many people (including myself) have noticed is that hard drive usage in Windows 10 often jumps to 100% and stays there for a while.

One of the reasons for this is automated drive optimization, which runs defrag on schedule. Chances are that you don’t need this, or don’t needed it as frequent. You can either disable scheduled optimization, or change the schedule.

Tap Search and search search for “defrag”. Select Defragment and Optimize Drives desktop app from search results. When the app opens, click on Turn Off under “Scheduled optimization” section. A new window with options will pop up – you can either disable optimization, or change the frequency so that it runs less often.

OptimizeDrives

This should solve your problem with hard disk thrashing under Windows 10. If you are still having the issue, culprit could be one of third party services or background applications that are running on your PC.