mysql: finding username - mysql

I have mysql installed on my Mac and when i check the system preferences it shows that it is running.
When, while trying to follow a tutorial, I try to create a database
mysql> create database tinyclone;
I get this error
mysql> create database tinyclone;
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'tinyclone'
Before creating the database, the author of the book does
mysql –u <username> -p <password>
However, I don't know my username, and I'm not 100% sure I know my password either.
I tried to do
sudo create database tinyclone;
and I got a different error message. Not sure what the problem with my syntax was
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 'sudo create database tinyclone' at line 1
Question, so that I can follow along with the book's author, anyone know how I can find out my mysql username and password?

I get this error
mysql> create database tinyclone;
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'tinyclone'
You're not logged in as any user (hence the ''#'localhost' bit). As others have suggested, try doing mysql -uroot -proot or mysql -uroot.
However, I don't know my username, and I'm not 100% sure I know my password either.
There is (almost) always a 'root' user created by default, usually with no password, unless you specified one when initially installing/configuring mysql.
I tried to do
sudo create database tinyclone;
and I got a different error message. Not sure what the problem with my syntax was
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 'sudo create database tinyclone' at line 1
sudo is not an SQL command. You cannot use it inside mysql. Instead log into sql with the 'root' user.
Also, please note that the mysql root user is not the same as your computer's root user.

C.5.4.1.3. Resetting the Root Password: Generic Instructions
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

You miss CREATE privilege.
Connect as a root user, create new user and grant CREATE privilege -
CREATE USER 'user1'#'localhost';
SET PASSWORD FOR 'user1'#'localhost' = PASSWORD ('your_password');
GRANT Create ON *.* TO 'user1'#'localhost'
Then connect as 'user1'#'localhost' -
mysql> --user=user1 --p=your_password
...and create new database -
CREATE DATABASE tinyclone;

Usually when you install mySQL you're prompted for password for the admin user (root) if you skipped it the only user currently available for mysql is root and that user doesn't have password enabled (which isn't a great idea for production environment)
So, what you should do is:
~$ mysql -u root
then
create database tinyclone

Related

unable to create database in mysql or via ssh

I m trying to create new database through mysql or ssh but on both m getting error
mysql : CREATE DATABASE porto;
Error : Access denied for user 'root'#'localhost' to database 'porto' on ssh : ERROR 1044 (42000): Access denied for user 'root'#'localhost' to database 'porto'
mysql> CREATE USER 'testuser'#'localhost' IDENTIFIED BY 'ecomaddon#42';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> SELECT User,Host From mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'root'#'localhost' for table 'user'
Its problem of privilege but don't know how give root user all privilege ai had try all methods but got nothing.
You can try to access as root
mysql -h 127.0.0.1 -P 3306 -u root -p
If it still does not work follow this guide
https://www.a2hosting.com/kb/developer-corner/mysql/managing-mysql-databases-and-users-from-the-command-line
you may be login as root but the root#localhost is not allowed for the actions you are executing.
mysql>CREATE USER 'root'#'localhost' IDENTIFIED BY 'enter_your_password_here';
mysql>exit
then try logging-in again
I think it's rights issue & It can be resolved by re configuring again. Here's a steps to reconfigure it.
Stop the current MySQL server instance:
sudo service mysql stop
Use dpkg to re-run the configuration process that MySQL goes through on first installation. You will again be asked to set a root password.
sudo dpkg-reconfigure mysql-server-5.5
Thanks for reply to all
i had solve i
1. first login to new user.
2. give access all to that users by update command .
3. drop root user and rename second user to root.
main problem was : when we create root it didn't give grant_priv field access users .

How to create mysql database using command prompt? I'm getting error ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'ivs'

I want to create database in mysql I installed MySQL 5.6 in windows 8, During installation installer never asked me username or password. When I'm executing command "create database ivs;" it gives me following error:
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'ivs' what can I do now?
You have use the default User and not root. The default User dosent have enough right to Create Databases. Start the Client with root User
c:> mysql -uroot
After great discussion with #Bernd Buffen I got solution for my problem, when I use 'create database ivs' I actually not logged in with 'root' user (I'm logged in with guest user) so to change this to root I use following command:
C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin>mysql -uroot
and then I use
mysql> create database ivs; to create database named 'ivs'

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.

Access root for newly installed MySQL on nitrousio box?

EDIT- Turns out to be a silly question. The solution:
mysql -u root Don't put a -p as there is no password for fresh installs of MySQL root.
Original Question:
Autoparts just came out recently on nitrous: http://blog.nitrous.io/2013/09/18/introducing-autoparts-for-nitrous-io.html
and I ran the command $ parts install mysql to install mySQL...works great!
Now, how do I access mysql to setup a root user or other users?
mysql> CREATE DATABASE django_db;
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'django_db'
mysql> GRANT ALL ON django_db.* TO 'djangouser'#'localhost' IDENTIFIED BY 'mypassword';
ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'django_db'
I don't know how to access mysql -u root -p because I don't know the root password, so I just used mysql to access the mysql from the terminal.
My end goal is to have the mysql setup on my box for a development and testing for my django web application.

I can't set the root password for MySQL

I've just set up a LAMP server using SuSE Server 10. I want to set the root password for MySQL, so I entered the following in the terminal:
mysqladmin -u root password MyPassword
and the output is:
mysqladmin: Can't turn off logging; error: 'Access denied; you need SUPER
privilege for this operation'
I'm not really certain what SUPER privilege is for mysqladmin, and all my Google searches have been fruitless. I am able to use mysql from the command line without entering a password like this:
mysql -u root
But I can't access the mysql database to update the root password that way. Here is the output:
mysql> USE mysql;
mysql> ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'mysql'
Any help would be greatly appreciated. Thanks.
I am still unsure what the solution to this problem is, but the solution I came up with was to install SuSE 11. Everything is working now. I think there was just a problem with my initial install.