Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Saturday, October 4, 2008

Problems with load data

You may be trying to use some features which directly load a database from a file to the database that you are using  like the following

 

ERROR 1148: The used command is not allowed with this MySQL version

 

 

 

This usually happens if your client or the server is not configured to use the local infile. This  is a pretty common error. I was going through some of the sql commands and came across this one. The typical solution to this one would be use the loose local infile, in the .my.cnf file, which goes something like this

[client]
loose-local-infile=1

 

 

Another solution is if you are starting your mysql  , try and see the mysql –help, it will spew out some of the following help messages

 

 

  -g, --no-named-commands

                      Named commands are disabled. Use \* form only, or use

                      named commands only in the beginning of a line ending

                      with a semicolon (;) Since version 10.9 the client now

                      starts with this option ENABLED by default! Disable with

                      '-G'. Long format commands still work from the first

                      line. WARNING: option deprecated; use

                      --disable-named-commands instead.

  -i, --ignore-spaces Ignore space after function names.

  --local-infile      Enable/disable LOAD DATA LOCAL INFILE.

  -b, --no-beep       Turn off beep on error.

  -h, --host=name     Connect to host.

  -H, --html          Produce HTML output.

  -X, --xml           Produce XML output

 

 

Try and use the mysql –u root –local-infile=1 and then try to use mysql , you will be able to work on it faster

 

 

How to start the mysql server

Initially you may have to go through  a bulk load of information and then get tired and pissed off. That was what had happened to me sometime back. Now I am back again to work and some how bubbling with energy tried to understand how it works,

 

Finally , it is no rocket science folks and neither is rocket science that difficult.

First see that mysql_install_db is started with the proper datadir and basedir options,

 

Your basedir should be the depot location where your mysql is installed. First and foremost do try to get into a machine where a daemon is not running. I presume you are running from some where in the office network and may be want to be careful before running a powerful server.

 

Try and fill up a .my.cnf file in your home directory which looks like this

[mysqld]

datadir=/remote/vtghome3/paragp/SCRATCH/mymysql

socket=/remote/vtghome3/paragp/SCRATCH/mymysql/thesock

port=8081

 

[mysql]

socket=/remote/vtghome3/paragp/SCRATCH/mymysql/thesock

port=8081

 

[mysql.server]

user=mysql

basedir=/var/lib

 

[safe_mysqld]

err-log=/remote/vtghome3/paragp/SCRATCH/mymysql/the.log

 

 

 

And then try to run the server.

 

Using mysqld_safe ( this is the one that will run the daemon ) , the problem with this one is, you may see errors which looks like this

Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

 

Just link your socket that  you have put in the my.cnf file to /tmp/msql.scok and then run it,

You will be able to use the mysqladmin command from now on . Next in series I will try to tell you guys all the powers of mysqladmin and what all could be done using it.

 

Wednesday, May 14, 2008

Trying MySql over linux

I have been trying to get the mysql server running on a linux machine in the office network here. I am getting the following error.
mysql_install_db --user=mysql1
mkdir: cannot create directory `/var/lib/mysql/mysql': Permission denied
chmod: cannot access `/var/lib/mysql/mysql': No such file or directory
mkdir: cannot create directory `/var/lib/mysql/test': Permission denied
chmod: cannot access `/var/lib/mysql/test': No such file or directory
Installing all prepared tables
080514 2:45:33 [Warning] Can't create test file /var/lib/mysql/vgamd81.lower-test
080514 2:45:33 [Warning] One can only use the --user switch if running as root

ERROR: 1049 Unknown database 'mysql'
080514 2:45:33 [ERROR] Aborting

080514 2:45:33 [Note] /usr/libexec/mysqld: Shutdown complete

Installation of system tables failed!

Examine the logs in /var/lib/mysql for more information.
You can also try to start the mysqld daemon with:
/usr/libexec/mysqld --skip-grant &
You can use the command line tool
/usr/bin/mysql to connect to the mysql
database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/bin/mysqlbug script!


What I am trying?
I will try to get some solution in the linux discussion groups for my sql. If it is possible to get MySQL to work then I will post it here. Till then as a placeholder I am keeping this blog