If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Syntax incorrect

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-30-09, 08:16
satimis satimis is offline
Registered User
 
Join Date: Jun 2006
Posts: 56
Syntax incorrect

Hi folks,


Have created a database 'maildb' and ran following steps entering data afterwards.


mysql> use maildb;

mysql> show tables;
Code:
+------------------+
| Tables_in_maildb |
+------------------+
| aliases          | 
| domains          | 
| users            | 
+------------------+
3 rows in set (0.01 sec)
Ran following command mistakenly;
Code:
mysql> INSERT INTO users (id,name,maildir,crypt) VALUES
    -> ('root@localhost','root','root/', encrypt('apassword') );
Query OK, 1 row affected (0.00 sec)
Then exit mysql.

I should replace 'apassword' with the password used on other files, say 'abcde'.

Following data have been set on "users"

mysql> DESCRIBE users;
Code:
+-----------------+----------------------+------+-----+-------------------------+-------+
| Field           | Type                 | Null | Key | Default                 | Extra |
+-----------------+----------------------+------+-----+-------------------------+-------+
| id              | varchar(128)         | NO   | PRI |                         |       | 
| name            | varchar(128)         | NO   |     |                         |       | 
| uid             | smallint(5) unsigned | NO   |     | 5000                    |       | 
| gid             | smallint(5) unsigned | NO   |     | 5000                    |       | 
| home            | varchar(255)         | NO   |     | /var/spool/mail/virtual |       | 
| maildir         | varchar(255)         | NO   |     | blah/                   |       | 
| enabled         | tinyint(3) unsigned  | NO   |     | 1                       |       | 
| change_password | tinyint(3) unsigned  | NO   |     | 1                       |       | 
| clear           | varchar(128)         | NO   |     | ChangeMe                |       | 
| crypt           | varchar(128)         | NO   |     | sdtrusfX0Jj66           |       | 
| quota           | varchar(255)         | NO   |     |                         |       | 
| procmailrc      | varchar(128)         | NO   |     |                         |       | 
| spamassassinrc  | varchar(128)         | NO   |     |                         |       | 
+-----------------+----------------------+------+-----+-------------------------+-------+
13 rows in set (0.00 sec)
I tried to correct the mistake with the correct password by running following commands without result;

mysql> UPDATE users SET crypt='apassword'('abcde') WHERE id='root@localhost';
Code:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('abcde') WHERE id='root@localhost'' at line 1
mysql> UPDATE users SET crypt=encrypt('apassword')(encrypt('abcde')) WHERE id='root@localhost';
Code:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(encrypt('abcde')) WHERE id='root@localhost'' at line 1
mysql> UPDATE users SET crypt='encrypt('apassword')'(encrypt('abcde')) WHERE id='root@localhost';
Code:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'apassword')'(encrypt('abcde')) WHERE id='root@localhost'' at line 1
etc.

Please advise the correct syntax to be used. TIA


B.R.
satimis
Reply With Quote
  #2 (permalink)  
Old 05-08-09, 07:52
ashish_mat1979 ashish_mat1979 is offline
Registered User
 
Join Date: Aug 2005
Posts: 30
Try below query instead:-

mysql> UPDATE users SET crypt=ENCRYPT('abcde') WHERE id='root@localhost';
__________________
Ashish
Entertainment Overloaded
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On