Php my admin privileges

Forum Tutorial — User Levels #3 — Admin Privileges, Banning Users & Logging Out

Introduction: This tutorial is the third and final episode to the User Levels section of my Forum Creation Tutorial series. In this part, we are going to be adding banning functionality and giving the admins their privileges. Admin Privileges: This part is essentially the same as the moderator privileges part found the previous tutorial. Once the user has logged in using our login form found in login.php we check if the user level of that user is 3 (admin), if it is we set the isAdmin session variable.

Next, we go to the checks for moderators and add the exception for admins so admins too can delete posts by other users. So add:

Finally we want to add a check just under where we continue our session and connect to our database on the admin panel page to check that the user accessing the page is an admin.

Banning Users: Next we want to add the ability for admins to ban users. We could add a new column in to our database to hold their current ban status (0 or 1, false or true, unbanned or banned) but instead we are going to use their level as 0 if they are banned. First we add another option next to the change level option for every user within the admin panel.

Next we need to process when the get parameter of act is ban, we grab the user id from the url as well (through PHP GET statements) then we set their user level to 0. (Appending on to the end of the if statement script which checks for the act level parameters):

Finally we need to check on login if the user is banned, if they are then we give an error otherwise we allow them to login as normal.

Logout Script: I thought I had already covered logging out scripts, but I don’t seem to have a logout page in my directory. The script is a simple two line php script and simply connects to the session then destroys it ready for a new one the next time another script connects.

Источник

Sql how to get privileges in phpmyadmin

Solution 2: your best option is to set add a new user with a password and grant FULL privildeges, on you connection use the new user Open PhpMyAdmin select «Users» underneath the know users is the option «add user» add login information as required tick the 2 boxes in the «database for users section» now «Check All» in the Global privideges and click go, new user is then set up and you can use it as your new connection Solution 3: go to Php My Admin home page of wamp At the very top in grey you can see your connection is «localhost» Underneath where you see your connection is local, are 10 tabs which are. Databases | SQL | Status | Users | Export | Import | Settings | Binary log | Replication | More as you can see option 4 is «Users» I added the user through the privileges area, and this seemed to work.

Can’t grant user privileges in PHPMyAdmin

Probably you are looking into the wrong place. after your GRANT command try using SHOW GRANTS command like

SHOW GRANTS FOR ''@'localhost' 

Turns out you can see the users in PhpMyAdmin two ways. in the «users» area and in the «privileges» area, inside the table. I added the user through the privileges area, and this seemed to work. I had to delete the user and create it again however.

Читайте также:  Python ожидание выполнения функции

How to add user in phpmyadmin, To create a new user, click the Add a new user link near the bottom of the Privileges page (you must be a «superuser», e.g., user «root»). (emphasis mine).

PhpMyAdmin User privileges (MySQL tutorial for MySQL privileges)

How to user phpMyAdmin user privileges (aka MySQL privileges). In this video you will learn Duration: 5:47

Phpmyadmin Users and Privileges

Create a user and grant privileges only their own databases

I cannot change the privileges in phpmyadmin what can I do

It seems something bad has happened with your root account.

You could try logging in as ‘root’@’127.0.0.1′ (or @’%’, depending on your distribution) — it’s possible that other account hasn’t also been damaged in the same way. To do that, edit your phpMyAdmin configuration file, config.inc.php , and change the host field from ‘localhost’ to ‘127.0.0.1’. Then you can go in and edit the root@localhost user to give all the permissions.

If that doesn’t work, you’ll probably need to reset the permissions for your user. There’s an answer over at serverfault that pretty clearly lists the steps:

The details you can find in the MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

  1. Shutdown MySQL
  2. Start MySQL with: mysqld —skip-grant-tables —skip-networking
  3. In mysql run: UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’) WHERE User=’root’; GRANT ALL PRIVILEGES ON *.* TO ‘root’@’localhost’ WITH GRANT OPTION;
  4. Shutdown MySQL
  5. Start MySQL as you usually do.

You might be able to log in through phpMyAdmin for step 3 rather than running the commands manually.

The exact SQL command to run might change depending on your MySQL/MariaDB version, please let me know which version you’re running so I can adjust the command accordingly.

Читайте также:  Java последнее вхождение в строку

How to Grant all Privileges to a User in MySQL with cPanel?, How to Grant Privileges to user || grant all privileges || Oracle MySQL database [solved Duration: 2:15

Issues with giving permission to user PHPMYADMIN

«. syntax error near ‘GRANT . » probably means that whatever was immediately before GRANT is the real syntax error. Maybe a missing ; ? Maybe something else.

«Syntax error» is very good at pointing exactly at, or immediately after, the offending token.

PhpMyAdmin. User disappears in privileges tab, -Create new user at localhost. Uncheck global privileges, grant all privileges on database. -Go to specific table, uncheck all privileges. «You

No privilege in PhpMyAdmin from Wamp

The following command can be used to set the password for the root user and grant all privileges:

UPDATE mysql.user SET Password=PASSWORD('NewPasswordHere') WHERE User='root'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'; FLUSH PRIVILEGES; 

Place this SQL code into a text file and save it some place convenient. Then, kill the SQL server. Open a command prompt and cd to the directory where the mysql-nt executable is stored. Execute this command:

mysqld-nt --init-file=sql-file-saved-above.txt 

Kill the SQL process you just started and restart the server normally and all should be good. Depending on how you have phpMyAdmin configured, you might need to adjust its configuration if you have the root password saved there.

your best option is to set add a new user with a password and grant FULL privildeges, on you connection use the new user

select «Users» underneath the know users is the option «add user»

add login information as required

tick the 2 boxes in the «database for users section»

now «Check All» in the Global privideges and click go, new user is then set up and you can use it as your new connection

go to Php My Admin home page of wamp

At the very top in grey you can see your connection is «localhost» Underneath where you see your connection is local, are 10 tabs which are.

Databases | SQL | Status | Users | Export | Import | Settings | Binary log | Replication | More

as you can see option 4 is «Users»

Create a user and grant privileges only their own databases, How to create separate users for separate Database in phpMyAdmin · MySQL CREATE USER Duration: 2:46

Источник

Как решить «No Privileges» при создании базы данных в phpMyAdmin?

43d423e7b32c474aaa055058c2bb9ffb.png

Установил lamp сервер на линукс минт (32-битный). Установил phpMyAdmin, вошёл, захотел создать базу данных, а не могу. Говорит, что отсутствуют какие-то привилегии.

Помогите, гуру пхп, как разрешить эту ситуацию.

UPDATED:
SHOW GRANTS FOR CURRENT_USER;
выдаёт

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION

Оценить 20 комментариев

Читайте также:  Python order by desc

LenovoId

devellopah

LenovoId

Islam Ibakaev: блин. удали phpmyadmin и вообще всё что связано с локальным сервером и заново установи . умеешь ?

devellopah

LenovoId

devellopah

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED VIA unix_socket WITH GRANT OPTION

LenovoId

Islam Ibakaev: ну ваще все НО как видите привилегии не работают , какой то сбой или вы что то натворили и сами не знаете что именно

devellopah

Максим Ленский: устанавливал lamp по этому туториалу. Всё установилось с первого раза и без проблем. В phpmyadmin захожу, как показывает автор видео, через логин — phpmyadmin и пароль — пароль к mariadb.

Вы предлагаете удалить весь стек(апачи, марию, пхп) или что именно?

LenovoId

603a60d513f94470b1262eee8e3e35b4.png

Islam Ibakaev: полностью всё php phpmyadmin все зависимости и установить заново , только во время установки будет настройка как самой базы так и phpmyadmin и вам всё что надо будет сделать это указать пароль один и тот же и всё .. установка занимает не долгих 10 — 15 минут и без проблем так же вам установится php7 и phpmyadmin самый последний

могу так же показать версию php

devellopah

Максим Ленский: и как мне без мучений всё удалить. я не помню сколько всего пхп зависимостей я устанавливал : (
Можно ли как-то быстро и без суеты удалить весь стек?

LenovoId

LenovoId

devellopah

Максим Ленский: может установить lamp через tasksel поверх уже установленного стека? забыл упомянуть, что через терминал я могу создать базы данных, однако они не отображаются в phpmyadmin

LenovoId

Islam Ibakaev: sudo apt-get install lamp-server^ вот так он устанавливается потом sudo apt-get install phpmyadmin и всё

LenovoId

devellopah

я ввёл команду select Host, User from mysql.user; и он мне выдал двух пользователей: phpmyadmin и root. Я входил через phpmyadmin как показывал автор туториала(выходит что этот пользователь не привилигирован). У меня есть подозрения что root пользователь привилигирован, однако я не знаю как войти через него, собственно автор туториала ничего не говорит про это)
Я создал ещё одного пользователя и дал ему полные привилегии. Теперь всё работает как надо)

Просто интересно какой пароль нужно ввести чтобы войти через root пользователя.

devellopah

devellopah

Максим Ленский: в видео автор показывает как войти в админку через пользователя phpmyadmin(который как я уже понял не привилигирован). Как войти через root юзера(какой пароль использовать) не ясно)

LenovoId

Islam Ibakaev: как правило дают пароль от системы НО многие делают и свой пароль .. другой скажем пароль системы линукс( как при входе) 123890 то и пароль дают такой же но в принципе можно любой диж бы при установке phpmyadmin и когда появляется связка sql +admin не было ошибок из за этого возникают подобные конфликты

В Ubuntu mysql по умолчанию ставится с plugin, который привязывает root-пользователя из MySQL к системному root-пользователю. Поэтому нужно из терминала сделать sudo mysql, а потом создать еще одного пользователя с ALL PRIVILEGES.

Источник

Оцените статью