Cannot connect to MySQL via XAMP - mysql

It has been headache for me to connect to MySQL.
Background:
OS: Windows 7 (64 bits)
I have been trying to connect to the MYSQL. I am using XAMPP control panel v3.1.0.
The Apache is working fine and I can run my PHP programs on it to upload and move files and all.
I connect the MySQL and it shows in XAMP and it is running :
12:27:48 PM [mysql] Attempting to start MySQL app... 12:27:48 PM
[mysql] Status change detected: running
I logged in to http://localhost/phpmyadmin and it did not ask me a password as XAMPP did not ask me for any password during the time of installation.
I created username pingu from http://localhost/phpmyadmin and gave it a password as well.
My questions:
1.) I do not know how to login as a user.
I get the following error when I use: mysql> -u pingu -p;
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 '-u pingu -p' at line 1
I have even tried:
mysql> -u root -p admin;
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 '-u root -p admin' at line 1
2.) When I try to create a database from the command line MySQL it gives me the following error:
MySQL> CREATE DATABASE publications; ERROR 1044 (42000): Access denied
for user ''#'local host' to database 'publications'
Any ideas?

First locate your XAMPP install C:\Program Files\xampp for a full install.
Open a new Command Prompt Window:
Click Start
Type "cmd"
Hit enter
In Command prompt go to the XAMPP directory do not include the C: part
cd \path\to\xampp
Start MySql:
mysql\bin\mysql.exe -u pingu -p

Related

How can I connect to MySQL server remotely using MySQL command line client (In Windows)? keep getting error 1064 (4200)

I'm using this method below to connect to my remote MySQL database but I keep getting this error message back:
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 '-u admin -p demo123-h testaurora-cluster-1.cluster-tjiy9ao2kavg.us-west-2.' at line 1
Method:
mysql -u USERNAME -p PASSWORD -h HOSTNAMEORIP DATABASENAME
The options above means:
-u: username
-p: password (**no space after**)
-h: host
last one is name of the database that you wanted to connect.
Look into the the link, it's detailed there!
Code entered in MySQL command line client:
mysql -u admin -p demo123-h testaurora-cluster-1.cluster-tjiy9ao2kavg.us-west-2 TestTable
I would highly appreciate it if you can let me know what I am missing here..

How to take mysql database Backup in MAC os via command prompt

i am using MAC os and trying to get the mysql database backup with the following command but its giving database error:
mysqldump -u root -proot syslog > syslog.sql
while running this command showing this error:
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 '-u root -p syslog > syslog.sql' at line 1
You appear to be running mysqldump from within the mysql interpreter. Instead, you need to run it from your shell prompt.

django-mysql-manager: CREATE ROLE administrator WITH LOGIN CREATEDB CREATEROLE PASSWORD '1234';

In installing django-mysql-manager:
$ source <venv>/bin/activate
(venv)$ pip install django-mysql-manager
$ mysql -u root -p'root'
mysql> CREATE ROLE administrator WITH LOGIN CREATEDB CREATEROLE PASSWORD '1234';
I got the error message:
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 'ROLE administrator WITH LOGIN CREATEDB CREATEROLE PASSWORD '1234'' at line 1
What went wrong?
As the error says, that is not a valid command for MySQL.
MySQL does not have any such concept as roles, so that command simply does not exist. Perhaps you were meaning to run it against PostreSQL?

Unable to import database to mysql in CentOS 6.3

I want to import database file to MySql in Centos 6.3 I entered the following command mysql -u root -p database < filename.sql but I faced the error as
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 'mysql -u root -p Kalsym < /tmp/dump.sql' at line 1
I have tried all the commands that I found on various forums but nothing seems to be working here :(
I guess you run this query after login into your MySQL server as it gives sytax error, right?
This command is run from the shell not from the mysql console..
So try running from command prompt/ shell not after login in to the mysql server.
Thanks

Trying to set MySQL root password results in error

I'm still very new to MySQL and Debian, but have been reading a lot during the last days.
I have a root account to a virtual machine that I want to use for Wordpress. One thing I read was that I should password protect MySQL because by default root user doesn't need a password for it.
I read someone doing it like this:
mysql> mysqladmin -u root password mypassword;
But that gives me the following error:
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 'mysqladmin -u root password mypassword' at line 1
You are running the command from within mysql, but the command is actually meant to be run directly from the terminal.
mysqladmin -u root password mypassword
If you are already in mysql within terminal, type exit then enter your mysqladmin command.