LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-30-2015, 08:52 AM   #1
sayhello_to_the_world
Member
 
Registered: May 2013
Posts: 229

Rep: Reputation: Disabled
executing a sql-statement on a mysql-server fails every-time - with demo


first of all - i am not sure if this question is posted in the right forum
i have server - and on this server (which is adminstrated by a friend of me) :: i want to install a software on this server

therefore i have to add a sql file onto the server-db

in earlier times i was running phpmyadmin on the server.
now we have webmin - and i am fairliy new to webmin

note: according to the manual here http://wiki.jobberbase.com/install/guide-for-apache

i want to include a db into the db that i have had created.

question: how to do that - with webmin -

if i add a little snipped - nothing happens - no table were being created.
i have no glue why

is it a permission issue - or what?


Quote:
-- phpMyAdmin SQL Dump
-- version 4.1.9
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Apr 14, 2014 at 09:51 AM
-- Server version: 5.5.34
-- PHP Version: 5.5.10

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `jobberbase`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(16) NOT NULL,
`password` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`id`, `username`, `password`) VALUES
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3');

-- --------------------------------------------------------

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`var_name` varchar(32) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`keywords` text NOT NULL,
`category_order` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `category_order` (`category_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='programming/design/admin/etc.' AUTO_INCREMENT=15 ;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `name`, `var_name`, `title`, `description`, `keywords`, `category_order`) VALUES
(1, 'Programmers', 'programmers', '', '', '', 7),
(2, 'Designers', 'designers', '', '', '', 3),
(3, 'Administrators', 'administrators', '', '', '', 0),
(7, 'Marketers', 'marketers', '', '', '', 2),
(5, 'Testers', 'testers', '', '', '', 5),
(6, 'Editors', 'editors', '', '', '', 1),
(8, 'Managers', 'managers', '', '', '', 4),
(9, 'Consultants', 'consultants', '', '', '', 6);

-- --------------------------------------------------------

--
i get back this results:


Quote:

Output from SQL command CREATE TABLE `admin` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(16) NOT NULL,
`password` varchar(32) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- --
Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `password`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3'); --
-------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories`
( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `var_name` varchar(32) NOT NULL, `title` text NOT NULL, `description` text
NOT NULL, `keywords` text NOT NULL, `category_order` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `category_order` (`category_order`) )
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='programming/design/admin/etc.' AUTO_INCREMENT=15
i have no glue why the executing of an sql-statement fains on the webmin


love to hear from you
 
Old 08-30-2015, 09:39 AM   #2
sayhello_to_the_world
Member
 
Registered: May 2013
Posts: 229

Original Poster
Rep: Reputation: Disabled
i get back this results:


Quote:

Output from SQL command CREATE TABLE `admin` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(16) NOT NULL,
`password` varchar(32) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; -- --
Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `password`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3'); --
-------------------------------------------------------- -- -- Table structure for table `categories` -- CREATE TABLE `categories`
( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `var_name` varchar(32) NOT NULL, `title` text NOT NULL, `description` text
NOT NULL, `keywords` text NOT NULL, `category_order` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `category_order` (`category_order`) )
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='programming/design/admin/etc.' AUTO_INCREMENT=15
i have no glue why the executing of an sql-statement fains on the webmin


love to hear from you

update

found some more issues - and error messages

if i try to upload the sql-file from the local machine then i get bck the statement below..

what does tis mean?

Quote:
Module Index Execute SQL

Output from uploaded SQL commands ..

ERROR 1064 (42000) at line 613: 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 '38214dc58d7791d92eb96a0a9b2703c80ec38dd922b9a7909ebe1e6437355ede72f8854641287bac' at line 49
 
Old 08-30-2015, 09:48 AM   #3
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
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
It means that there is an error in the SQL command...
Let's dissect...
Help me/us here, edit the post and put the SQL statements in code tags, the quote tags are very helpful, but are not meant to convey code as such
let me try to execute the command on my server here, if I may.
Thor
Edit
Code:
CREATE TABLE `admin` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(16) NOT NULL,`password` varchar(32) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2
works nicely...using PHPMyAdmin...
Second edit :
Code:
CREATE TABLE `categories`
( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `var_name` varchar(32) NOT NULL, `title` text NOT NULL, `description` text
NOT NULL, `keywords` text NOT NULL, `category_order` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `category_order` (`category_order`) )
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='programming/design/admin/etc.' AUTO_INCREMENT=15
Umm...works great too...
I'm confused...

Last edited by ButterflyMelissa; 08-30-2015 at 09:59 AM.
 
Old 08-30-2015, 10:18 AM   #4
sayhello_to_the_world
Member
 
Registered: May 2013
Posts: 229

Original Poster
Rep: Reputation: Disabled
hello



many many thanks again for the help. well i struggle with the webmin.
guess that it would work with phpmyadmin too..



btw: if we take a look at the whole installation of the script. then we have some more things left to configure:

see - http://wiki.jobberbase.com/install/guide-for-apache


btw: they want to know the Port
>
>
> // mysql credentials
> 'db_host' => 'localhost',
> 'db_port' => 3306,
> 'db_user' => 'root',
> 'db_password' => '',
>
> ist die 3306 korrekt?

well we do not have SQL over TCP here! we use UNIX-Socket.

this : /home/vhost/WWW/var/run/mysql/mysql.sock

well this might be another story - but what should i add here in the congiguration file


cf see - http://wiki.jobberbase.com/install/guide-for-apache


love to hear from you
 
Old 08-30-2015, 10:28 AM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Shouldn't you guys google for some MySql-quickstart-tutorial?
 
1 members found this post helpful.
Old 08-30-2015, 11:02 AM   #6
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
Shouldn't you guys google for some MySql-quickstart-tutorial?
LOL, yea, there is an idea...I hope OP has done that...
I just got triggered by the SQL error that was displayed. I tested the SQL and it works.
Quote:
/home/vhost/WWW/var/run/mysql/mysql.sock
@ OP - this worries me. should that be in the home folder?
Quote:
well i struggle with the webmin
as far as I can see, webmin is web based, my thought is that it cannot have an impact...
because...the SQL you posted does work. Is it possible to see line 613, where the error DOES seem to happen? Mostly a quote, a comma or something small is missing...
Thor
 
Old 08-30-2015, 02:38 PM   #7
sayhello_to_the_world
Member
 
Registered: May 2013
Posts: 229

Original Poster
Rep: Reputation: Disabled
hello you both - because of the sockets


we ve got unixsocket on the server that connect to the mysql-db

/home/vhost/WWW/var/run/mysql/mysql.sock


i follow this instrucitons on the server: http://wiki.jobberbase.com/install/guide-for-apache

within the configuration the db port is metioned .
>
>
> // mysql credentials
> 'db_host' => 'localhost',
> 'db_port' => 3306,
> 'db_user' => 'root',
> 'db_password' => '',


my server admin told me that SQL did not run over TCP - here. we allway used and will use
UNIX-Socket

does this mean that i have to do the edit like so

>
> // mysql credentials
> 'db_host' => 'localhost',
> 'db_port' => '/home/vhost/WWW/var/run/mysql/mysql.sock,
> 'db_user' => 'root',
> 'db_password' => '',


love to hear from you



note: i follow this instrucitons on the server: http://wiki.jobberbase.com/install/guide-for-apache
 
Old 08-31-2015, 09:58 AM   #8
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
db_port' => '/home/vhost/WWW/var/run/mysql/mysql.sock,
No, this is not a port, a number is required here...if this setup was not altered (too much) the original port still is 3306...
Of course, I use mySQL completely different. I did a port scan and this port is not open, but...I approach the data via my own components...I have no need to open a port outside anyway...
Thor
 
Old 08-31-2015, 07:56 PM   #9
sayhello_to_the_world
Member
 
Registered: May 2013
Posts: 229

Original Poster
Rep: Reputation: Disabled
dear Thor

many many thanks for all the help. GREAT to see all your ideas & help here in the forums.

topic solved - now all works like a charme


thx for all the help
 
Old 09-01-2015, 08:39 AM   #10
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Good to hear
Mark the thread as solved after you posted the solution that worked for you...for the users in the future that may stuggle with a similar challenge
Thor
 
Old 09-08-2015, 03:09 PM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Thor_2.0 View Post
Good to hear
Mark the thread as solved after you posted the solution that worked for you...for the users in the future that may stuggle with a similar challenge
Thor
Good luck with that, Thor_2.0. Please see the OP's posting history.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running mysql from ssh & query statement has a Text Header in the SELECT statement? djlerman Linux - Server 6 11-19-2013 06:33 PM
[SOLVED] Converting SQL Scripts for MS SQL Server to Postgresql or MySQL markush Programming 4 09-12-2013 02:09 PM
SQL update statement to SQL SERVER 2005 scheidel21 Programming 2 11-05-2009 06:30 PM
My SQL statement to delete an entry in MYSQL database fails in PHP ratchie Linux - Software 1 12-29-2008 02:48 AM
mysql sql statement help mrtwice Programming 4 12-02-2003 10:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration