Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
found a few similar threads but still can't get my mySQL to work
I've got an older Redhat 4 installation which I installed mySQL from the cd's at system install time
Code:
# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
I can use this to get a connection like:
Code:
# mysql -umysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
but I can't seem to do much in there ... this works
Code:
mysql> show databases;
+----------+
| Database |
+----------+
| test |
+----------+
1 row in set (0.00 sec)
... but
I can't seem to create anything (user or database) ... I can't even grant myself anything.
found a few similar threads but still can't get my mySQL to work
I've got an older Redhat 4 installation which I installed mySQL from the cd's at system install time
... but
I can't seem to create anything (user or database) ... I can't even grant myself anything.
any thoughts?
Yep...you don't have rights to do anything, and don't have any databases defined. From the MySQL box, try SU'ing to root, and (as root), try just typing in "mysql".
The root user (from a fresh installation), is granted all rights locally. You should be able to create more users, databases, etc., from that point, and not have to go in as root again, except for rare cases.
You have logged in as mysql user (i mean your mysql login) this user haven't all rights therefore login your mysql using root user(supper user).
Read again TB0ne post
Quote:
Yep...you don't have rights to do anything, and don't have any databases defined. From the MySQL box, try SU'ing to root, and (as root), try just typing in "mysql".
The root user (from a fresh installation), is granted all rights locally. You should be able to create more users, databases, etc., from that point, and not have to go in as root again, except for rare cases.
I can seemingly start, but I can only connect to the test database;
Code:
mysql> status;
--------------
mysql Ver 14.7 Distrib 4.1.12, for redhat-linux-gnu (i386) using readline 4.3
Connection id: 9
Current database: test
Current user: mysql@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 4.1.12
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: latin1
Conn. characterset: latin1
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 3 min 49 sec
Threads: 1 Questions: 19 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 1 Queries per second avg: 0.083
--------------
mysql> create database pergamentit;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'pergamentit'
mysql>
I tried making an edit in my conf file to add root ... just a wild stab
Code:
[root@home ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
user=root
basedir=/var/lib
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@home ~]#
but I'm ssh'ed into the server as root ... when I run the command
Quote:
# mysql --user=root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
yet ...
Quote:
# mysql --user=mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.12
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
I have even edited the file
Quote:
[root@oracle ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
Your MySQL installation doesn't accept the root user without password. This password you need is the one provided upon installation when asked.
Code:
mysql -u root -p
should ask you for a password. Once provided you are logged in as 'root' with all rights. If you still don't have any rights you will be able to grant yourself all rights on all databases, either on localhost or via client, or both.
The root password for MySQL root user is NOT always the same as the root user for your linux box. When installed MySQL asked you for a root password. If you provided the same as for your linux box then it should work. You can always reset the MySQL root password. Root on linux and Root on MySQL are two different logins.
FYI. You don't need to su to root first when logging in to mysql as root. Using the "-u root" is enough. You are accessing the 'root' user on the database, using the MySQL password, not the Linux root password.
There should be a mysql manual that came with your installation (probably on a pdf). Be sure to read
the section on securing mysql after installing.
use mysql;
select Host, User, password from user;
Make sure the password field isn't blank for the root user account when you are done following the last post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.