RE: Stored Procedures Question
You need create your select statement using a variable and the do the prepare statement; Drop Procedure If Exists RankStock; DELIMITER | Create Procedure RankStock(IN TableNameIn CHAR(20),IN ColNameIn CHAR(20)) begin Set @selStmt = Concat(Select ,ColNameIn, from ,TableNameIn, order by ,ColNameIn); Prepare s1 from @selStmt; Execute s1; Deallocate Prepare s1; END| DELIMITER ; Dan -Original Message- From: mos [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 04, 2006 10:58 AM To: mysql@lists.mysql.com Subject: Stored Procedures Question I have a dozen tables and I need to perform the same operations on them so I thought I'd create a stored procedure and just pass the table name, column name. I was hoping it would take the parameters and substitute that in the code. So it looks like this: create procedure RankStock(IN TableNameIn CHAR(20), IN ColNameIn CHAR(20)) begin select ColNameIn from TableNameIn order by ColNameIn; end; Of course this produces errors because it doesn't like the TableNameIn in the select statement. So from all this I have to assume I can't build a Select statement by using passed parameters. Is that right? TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- This email is intended only for the person or entity to which it is addressed and may contain confidential information. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you receive this e-mail in error, please contact the sender by replying to this e-mail and delete this e-mail and any attachments from all computers without reading or saving the same in any matter whatsoever. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: how to import a text file into the mysql database
shell # mysqlimport -u root -p webcalendar tables-mysql.sql where, 'webcalendar' is the database that i have created for this purpose. after entering the password at the password prompt it is displaying the following error: mysqlimport: Error: You have an error in your SQL syntax near 'tables-mysql' at line 1, when using table: tables-mysql Looks like there's nothing wrong with the command. Instead, you have bad sql syntax on line 1, or first uncommented line in the tables-mysql.sql file. Thanks... Dan. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: web clients: frustrated beyond my sanity
Kurt, Warning: MySQL Connection Failed: Access denied for user: 'mysite@localhost' (Using password: NO) in /home/mysite/public_html/phpMyAdmin/lib.inc.php3 on line 170 I have added users apache and mysite to /etc/group for group mysql, restarted Apache and mysql. Why is saying 'mysite@localhost' when the script is set to use mysql user 'dbuser' with valid password. Logging in as 'mysite', and trying 'mysql -u dbuser -p mysql' works. From another site at work, 'mysql -u dbuser -h mysite.ca -p mysql' works. It sounds like MySQL is denying access to user mysite. The OS isn't causing you problems; only MySQL is. Apache server is running as apache, however my host mysite.ca runs su-exec'ed as user/group mysite/mysite. And virtual host hersite.ca runs as regular hersite/apache. Either way, it fails. The mysqld is as user 'mysql: root 17657 1 1 14:45 pts/1 00:00:00 /bin/sh /usr/bin/safe_mysqld --datadir=/var/lib/mysql/data --pid-file=/var/lib/mysql/data/www.mysite.ca. mysql 17682 17657 3 14:45 pts/1 00:00:00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql/data --user=mysql --pid-file=/var/lib/mysql/data/www.mysite.ca As I understand your description, the user that is running the MySQL daemon is 'mysite'. You are trying to log in as 'dbuser', but for some reason MySQL is not getting that information and defaulting to the user that runs the daemon, mysite, with no password. However, my guess is that 'mysite' is not a granted privileges in MySQL so MySQL is denying access. I am trying to use 'dbuser' and valid password (works on command line), however it seems that MySQL returns an error for the UNIX user 'mysite'. I did add 'mysite' to mysql.user table and it works from command line, however it still won't work. Have you tried 'mysql -u mysite'? If you cannot get in, then part of the problem is not having 'mysite' set up with MySQL. Here is the page from the documentation that should help with setting up user 'mysite': No problems from the command line. http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Adm inistration.html#User_Account_Management You have a second problem: why isn't phpMyAdmin using 'dbuser' and 'mysql'? I have no experience with php so I'm sorry I can't help you there. I am starting over the permissions from scratch fingers crossed ;) Thanks... Dan. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
errors rotating logs and using phpMyAdmin
I have spent a week trying to resolve this, searching without success :( For the past week since an OS upgrade, the mysql log rotation fails... -- errors occured while rotating /var/lib/mysql/mysqld.log { ^G/usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user: 'root@localhost' (Using password: NO)' error running shared postrotate script for /var/lib/mysql/mysqld.log { -- /var/lib/mysql/mysqld.log { create 600 mysql mysql postrotate if test -n `ps acx|grep mysqld`; then /usr/bin/mysqladmin flush-logs fi endscript } I have proper settings in /root/.my.cnf file with user/pass which works. [mysqladmin] user = root password = itcroaks I also have problems with using phpMyAdmin from my server domain. Warning: MySQL Connection Failed: Access denied for user: 'programmer@localhost' (Using password: NO) in /home/programmer/public_html/phpMyAdmin/lib.inc.php3 on line 170 I get the same problems with phpWeblog and WebMin. The part that bothers me is (Using password: NO) Why? I only see this when I use mysql -u root without the -p option. 'root' has a password, as do all the MySQL users. The thing I don't understand is that connecting from the command line for any users works. # mysql -u {user} -p mysql On the Mandrake-Linux 8.0 server, I have... MySQL-shared-3.23.36-2mdk MySQL-client-3.23.36-2mdk MySQL-3.23.36-2mdk perl-Mysql-1.22_15-5mdk php-mysql-4.0.4pl1-6mdk Thanks...Dan. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php