LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Why is access denied to files I haven't made but I'm the owner, I'm the root. (https://www.linuxquestions.org/questions/fedora-35/why-is-access-denied-to-files-i-havent-made-but-im-the-owner-im-the-root-661337/)

Sonhi 08-08-2008 01:08 AM

Why is access denied to files I haven't made but I'm the owner, I'm the root.
 
Linux is pissing me off, I've gotten access denied to many files when I'm logged in as the root, I've made my user have access to ALL the groups, nothing works!

The user I'm logged in as was made as the owner when I set up fedora, please help me this is getting in my way. I've spent hours on google trying to find people with my problem but I've had no luck with solving it.

Mr. C. 08-08-2008 01:28 AM

First, consider the possibility that the system might actually work, and that you misunderstand.

Second, show exact commands and output that demonstrate the problem.

Sonhi 08-08-2008 01:36 AM

I began with that mindset, but with all the things I've been through I'm starting to have my doubts.

Anyways, heres what is happening.

[root@roland ~]# mysqladmin -u root password yourrootsqlpassword
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

thats the second command after I installed it.
(first command was)
[root@roland ~]# yum install mysql mysql-devel mysql-server


I didn't edit or change anything. So I went online to find out how to change the password and it tells me to open /var/lib/mysql to close a file before editing. So when I try to go there it tells me I can't view the contents because I don't have permission.

Mr. C. 08-08-2008 01:58 AM

I'll state it more forcefully: doubt your understanding, not the system.

This has nothing to do with Linux file system permissions. This is mysql telling you that the root user does not have access permissions from the host localhost. You need to correctly configure your mysql permissions table. Mysql does not have a password upon initial installation - you need to configure one.

Here's a howto. Start with step 2b and try to understand what is being done:

http://howtonixnux.blogspot.com/2008...ql-server.html

I make no claim this reference is valid or useful.

Sonhi 08-08-2008 02:21 AM

Alright, I got down to step 3a and from there I figured out I need to change my database, so from the tutorials I found I managed to get here:

[root@roland ~]# mysql_setpermission --host=localhost
Password for user to connect to MySQL:
######################################################################
## Welcome to the permission setter 1.4 for MySQL.
## made by Luuk de Boer
######################################################################
What would you like to do:
1. Set password for an existing user.
2. Create a database + user privilege for that database
and host combination (user can only do SELECT)
3. Create/append user privilege for an existing database
and host combination (user can only do SELECT)
4. Create/append broader user privileges for an existing
database and host combination
(user can do SELECT,INSERT,UPDATE,DELETE)
5. Create/append quite extended user privileges for an
existing database and host combination (user can do
SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
LOCK TABLES,CREATE TEMPORARY TABLES)
6. Create/append full privileges for an existing database
and host combination (user has FULL privilege)
7. Remove all privileges for for an existing database and
host combination.
(user will have all permission fields set to N)
0. exit this program

Make your choice [1,2,3,4,5,6,7,0]:


I chose number 6 and selected mysql database.
Okay we keep it with this ...
The following host(s) will be used: roland.sgameserver.com,localhost.
######################################################################

That was it ... here is an overview of what you gave to me:
The database name : mysql
The username : roland
The host(s) : roland.sgameserver.com,localhost
######################################################################

Are you pretty sure you would like to implement this [yes/no]:

Would this be correct?

Mr. C. 08-08-2008 02:51 AM

I cannot confirm if it is correct *for your situation*. This is creating a user, roland, that will be allowed to connect to mysql, from the host system itself,or the full domain name indicated above, and modify the permissions tabling granting full access.

You should then examine the tables in mysql and learn about the user and permissions models.

Sonhi 08-08-2008 03:08 AM

HEY! I was looking at a tutorial and they did mysql -u=root
so:
[root@roland ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@roland ~]# mysql -u=root
Welcome to the MySQL monitor. Commands end with ; or \g.


haha, I feel kinda stupid now
is linux this picky?

chrism01 08-08-2008 03:23 AM

Actually, the DB (ie schema) 'mysql' is basically the data dictionary for mysql itself. Only the mysql root user needs access to that, and usually you wouldn't touch it often.
Its best for normal users to either use the 'test' schema provided, or create a new one eg r_test and grant all privs to roland on that.

As mysql root:

mysql> create database r_test;
mysql> grant all on r_test.* to 'roland'@'localhost';

this assumes roland doesn't need a passwd for that db/schema. See mysql manual:
http://dev.mysql.com/doc/refman/5.0/...ing-users.html

Sonhi 08-12-2008 07:11 AM

Alright, thanks guys I think I found a solution. Now, I set up a server and I can only access it by using http://localhost

I have a router, and I'm thinking I would need to open a port or something so other people can view the site.


All times are GMT -5. The time now is 10:17 PM.