Showing posts with label MySql. Show all posts
Showing posts with label MySql. Show all posts

Monday, February 11, 2013

Disable Ubuntu One, MySql, Apache services on boot – Ubuntu 12.04

Ubuntu One is great, but when I am on battery power it just drains a lot. So what I need is, disable Ubuntu One service at startup. I can start it any time I like. But the problem is Ubuntu One is a hidden service. So let's unlock all the startup hidden services.

Open your terminal and fire up the following command:
$ sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop

Now open your "Startup Applications" GUI and you will be able to see a lot of things including Ubuntu One. Uncheck to make it disabled at startup. Enjoy :)

Use the follwing command to start or stop or to get more help later on for Ubuntu One:
$ u1sdtool --start
$ u1sdtool --quit
$ u1sdtool --help

Two other services I need on my system, but don’t want them to start unless I require them. They are running MySql and Apache.

To stop mysql from starting on boot:

sudo vim /etc/init/mysql.conf
# Comment out the following line
start on runlevel [2345]

To stop apache2 from starting on boot:
sudo update-rc.d -f apache2 remove

To enable apache2 on startup
sudo update-rc.d -f apache2 defaults


Tuesday, December 7, 2010

MySql - Get available Database, Tables, Columns and their Details

Get available database and their information: 
select * from INFORMATION_SCHEMA.SCHEMATA; Result Set Columns:
  1. CATALOG_NAME
  2. SCHEMA_NAME
  3. DEFAULT_CHARACTER_SET_NAME
  4. DEFAULT_COLLATION_NAME
  5. SQL_PATH
Note: SCHEMA_NAME column contains the database names as you need.

Get available table names from a database:
select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='test_db';

Result Set Columns:
  • TABLE_NAME contains the table name
Get table column details:
select COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMN_KEY, EXTRA from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA='test_db' and TABLE_NAME='user_profile';
If you want checkout INFORMATION_SCHEMA database inside MySql for more.