LinuxForum.Fans
Тема

Нету root в MySQL

Автор: StrongASB 62 сообщений 17003 просмотров
#157590

Установил mySQL и phpmyadmin на Debian 6 x64
При установке пароль не попросил,я удивился...
Могу зайти в phpmyadmin только через debian-sys-maint
Мне нужно создать пользователя root со всеми правами.
[console]root@energypw:~# mysqld_safe --skip-grant-tables &
[2] 6549
root@energypw:~# 110428 10:51:52 mysqld_safe Logging to syslog.
110428 10:51:52 mysqld_safe A mysqld process already exists
mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.49-3 (Debian)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password=PASSWORD('12') WHERE user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[2]+ Exit 1 mysqld_safe --skip-grant-tables
root@energypw:~#[/console]

Сделал Рестарт Мускула,пытаюсь зайти через phpmyadmin пишет:

Не удалось установить подключение для пользователя указанного в директиве controluser, с помощью параметров определенных в конфигурационном файле config.inc.php.

Вот содержание файла config.inc.php

text
<?php
/**
 * Please, do not edit this file. The configuration file for Debian
 * is located in the /etc/phpmyadmin directory.
 */
 
// Load secret generated on postinst
include('/var/lib/phpmyadmin/blowfish_secret.inc.php');
 
// Load autoconf local config
include('/var/lib/phpmyadmin/config.inc.php');
 
// Load user's local config
include('/etc/phpmyadmin/config.inc.php');
 
// Set the default server if there is no defined
if (!isset($cfg['Servers'])) {
    $cfg['Servers'][1]['host'] = 'localhost';
}
 
// Set the default values for $cfg['Servers'] entries
for ($i=1; (!empty($cfg['Servers'][$i]['host']) || (isset($cfg['Servers'][$i]['connect_type']) && $cfg['Servers'][$i]['connect_type'] == 'socket')); $i++) {
    if (!isset($cfg['Servers'][$i]['auth_type'])) {
        $cfg['Servers'][$i]['auth_type'] = 'cookie';
    }
    if (!isset($cfg['Servers'][$i]['host'])) {
        $cfg['Servers'][$i]['host'] = 'localhost';
    }
    if (!isset($cfg['Servers'][$i]['connect_type'])) {
        $cfg['Servers'][$i]['connect_type'] = 'tcp';
    }
    if (!isset($cfg['Servers'][$i]['compress'])) {
        $cfg['Servers'][$i]['compress'] = false;
    }
    if (!isset($cfg['Servers'][$i]['extension'])) {
        $cfg['Servers'][$i]['extension'] = 'mysql';
    }
}
#157606

как звучит вопрос то ?
1. Настроить мускуль по руководству самого мускуля тыц
2. Покажи что там есть в :
а) /var/lib/phpmyadmin/blowfish_secret.inc.php
б) /var/lib/phpmyadmin/config.inc.php
в) /etc/phpmyadmin/config.inc.php
как бы очевидно же ..

#157613

dpkg-reconfigure mysql (или как его там)

#157671

как звучит вопрос то ?

Мне нужно создать пользователя root со всеми правами.

а) /var/lib/phpmyadmin/blowfish_secret.inc.php
text
<?php
$cfg['blowfish_secret'] = 'AKd4v10gtufGOLhcPr7fNIEM';

б) /var/lib/phpmyadmin/config.inc.php

Пусто!

в) /etc/phpmyadmin/config.inc.php
text
<?php
/**
 * Debian local configuration file
 *
 * This file overrides the settings made by phpMyAdmin interactive setup
 * utility.
 *
 * For example configuration see /usr/share/doc/phpmyadmin/examples/config.default.php.gz
 *
 * NOTE: do not add security sensitive data to this file (like passwords)
 * unless you really know what you're doing. If you do, any user that can
 * run PHP or CGI on your webserver will be able to read them. If you still
 * want to do this, make sure to properly secure the access to this file
 * (also on the filesystem level).
 */

/** * Server(s) configuration */ $i = 0; // The $cfg['Servers'] array starts with $cfg['Servers'][1]. Do not use $cfg['Servers'][0]. // You can disable a server config entry by setting host to ''. $i++;

/** * Read configuration from dbconfig-common * You can regenerate it using: dpkg-reconfigure -plow phpmyadmin */ if (is_readable('/etc/phpmyadmin/config-db.php')) { require('/etc/phpmyadmin/config-db.php'); }

/* Configure according to dbconfig-common if enabled */ if (!empty($dbname)) { /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ if (empty($dbserver)) $dbserver = 'localhost'; $cfg['Servers'][$i]['host'] = $dbserver;

if (!empty($dbport)) { $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['port'] = $dbport; } //$cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ $cfg['Servers'][$i]['extension'] = 'mysqli'; /* Optional: User for advanced features */ $cfg['Servers'][$i]['controluser'] = $dbuser; $cfg['Servers'][$i]['controlpass'] = $dbpass; /* Optional: Advanced phpMyAdmin features */ $cfg['Servers'][$i]['pmadb'] = $dbname; $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; $cfg['Servers'][$i]['relation'] = 'pma_relation'; $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; $cfg['Servers'][$i]['history'] = 'pma_history'; $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; $cfg['Servers'][$i]['tracking'] = 'pma_tracking';

/* Uncomment the following to enable logging in to passwordless accounts, * after taking note of the associated security risks. */ // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

/* Advance to next server for rest of config */ $i++; }

/* Authentication type */ //$cfg['Servers'][$i]['auth_type'] = 'cookie'; /* Server parameters */ //$cfg['Servers'][$i]['host'] = 'localhost'; //$cfg['Servers'][$i]['connect_type'] = 'tcp'; //$cfg['Servers'][$i]['compress'] = false; /* Select mysqli if your server has it */ //$cfg['Servers'][$i]['extension'] = 'mysql'; /* Optional: User for advanced features */ // $cfg['Servers'][$i]['controluser'] = 'pma'; // $cfg['Servers'][$i]['controlpass'] = 'pmapass'; /* Optional: Advanced phpMyAdmin features */ // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; // $cfg['Servers'][$i]['relation'] = 'pma_relation'; // $cfg['Servers'][$i]['table_info'] = 'pma_table_info'; // $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; /* Uncomment the following to enable logging in to passwordless accounts, * after taking note of the associated security risks. */ // $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;

/* * End of servers configuration */

/* * Directories for saving/loading files from server */ $cfg['UploadDir'] = ''; $cfg['SaveDir'] = '';

dpkg-reconfigure mysql (или как его там)

[console]root@energypw:~# dpkg-reconfigure mysql
Package `mysql' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
/usr/sbin/dpkg-reconfigure: mysql is not installed
root@energypw:~#[/console]

#157691

ВВёл

dpkg-reconfigure mysql-server-5.1

Мне предложили ввести пароль для пользователя root
Я ввёл потом пошли вот эти ошибки!
[console]root@energypw:~# dpkg-reconfigure mysql-server-5.1
Stopping MySQL database server: mysqld.
Stopping MySQL database server: mysqld.
110501 12:32:18 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Can't create/write to file '/tmp/ibQXCZDS' (Errcode: 13)
110501 12:32:18 InnoDB: Error: unable to create temporary file; errno: 13
110501 12:32:18 [ERROR] Plugin 'InnoDB' init function returned error.
110501 12:32:18 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
root@energypw:~#[/console]

#157696

StrongASB, переустановить полностью мускул и phpmyadmin не?

text
aptitude purge mysql-server mysql-common mysql-server-5.1 mysql-server-core-5.1 phpmyadmin

потом подчистить в на всякий почистить все в /usr/share/mysql и /usr/share/mysql-common и где еще что там у вас, потом поставить заново

text
aptitude install mysql-server-5.1 mysql-server-core-5.1

пароль руту:
mysqladmin -u root password mysqlrootpassword

проверить:
mysqladmin -h serverip -u root password mysqlrootpassword

#157698


Checking for corrupt, not cleanly closed and upgrade needing tables..

== проверка некорректна , не закрыты и не обновлены таблицы ... - вам нужно правильно обновить базы(инициировать их)
в Слаке это делает команда :

text

mysql_install_db

в дебиане есть аналогичная команда , это просто скрипт на баше который содержит стандартные команды сервера MySQL . В документации они все есть , причем работают не зависимо от системы (и в Винде команды те же !) , ссылку я выше давал , конкретно по базам тыц ..

#157734

newzenon
Удалил,почистил,Установил...

[console]root@energypw:~# mysqladmin -u root password mysqlrootpassword
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
root@energypw:~# mysqladmin -h serverip -u root password mysqlrootpassword
mysqladmin: connect to server at 'serverip' failed
error: 'Unknown MySQL server host 'serverip' (1)'
Check that mysqld is running on serverip and that the port is 3306.
You can check this by doing 'telnet serverip 3306'
root@energypw:~# mysqladmin -u root password 12
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
root@energypw:~#
[/console]

mysql_install_db

[console]root@energypw:~# mysql_install_db
Installing MySQL system tables...
ERROR: 1004 Can't create file '/tmp/#sql3e53_1_0.frm' (errno: 13)
110501 14:01:12 [ERROR] Aborting

110501 14:01:12 [Note] /usr/sbin/mysqld: Shutdown complete


Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.

You can try to start the mysqld daemon with:

shell> /usr/sbin/mysqld --skip-grant &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/scripts/mysqlbug script!

root@energypw:~#[/console]

#157735

dpkg -l | grep mysql
text
ii  libdbd-mysql-perl                   4.016-1                      Perl5 database interface to the MySQL database
ii  libmysqlclient16                    5.1.49-3                     MySQL database client library
ii  mysql-client-5.1                    5.1.49-3                     MySQL database client binaries
ii  mysql-common                        5.1.49-3                     MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server-5.1                    5.1.49-3                     MySQL database server binaries and system database setup
ii  mysql-server-core-5.1               5.1.49-3                     MySQL database server binaries
rc  php5-mysql                          5.3.3-7+squeeze1             MySQL module for php5

dpkg-reconfigure name

[console]root@energypw:~# dpkg-reconfigure name
Package `name' is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
/usr/sbin/dpkg-reconfigure: name is not installed
[/console]

#157743

При утсановке phpmyadmin пишет
[console]Replacing config file /etc/phpmyadmin/config-db.php with new version
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO).
unable to connect to mysql server.
error encountered creating user:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
dbconfig-common: phpmyadmin configure: ignoring errors from here forwards
populating database via sql... done.
dbconfig-common: flushing administrative password
dbconfig-common: phpmyadmin configure: ignoring errors from here forwards
dbconfig-common: phpmyadmin configure: ignoring errors from here forwards
root@energypw:~#[/console]

#157746
text
ERROR: 1004  Can't create file '/tmp/#sql3e53_1_0.frm' (errno: 13)

А собственно что у вас с /tmp - права то есть?

#157752
StrongASB написал:
dpkg-reconfigure name

Что-то у вас похоже голова кипит уже. Вместо name нужно было ввести
[console]dpkg-reconfigure mysql-server-5.1[/console]
Хотя вроде можно просто ввести
[console]dpkg-reconfigure mysql-server[/console]

#157762

в общих чертах все выглядит следующим образом :
1 . мускуль должен быть установлен весь , порочная практика rpm/deb заточек , когда один(!) продукт делится на стопицоттысяч пакетиков и пакетишков имхо ЗЛО ... весь это значит ВЕСЬ ! от начала до конца ..
2 . управляющие скрипты должны иметь права на запуск .
3 . базовый демон должен быть запущен(и остановлен самим собой или системой если есть какие то ошибки в текушей конфигурации )
4 . базы данных должны быть созданы и инициированы посредством самого мускуля т.е. нативно , делается это стандартными средствами системы ..(mysql_install_db)
5 . умолчальные ресурсы мускуля (директория в базами , сами базы , пути к сокетам и сами сокеты должны иметь права\владельца умолчального базового пользователя мускуля , как правило это системный пользователь mysql состоящий в группе mysql (!) - это важно ...
6 . когда выше перечисленные требования выполнены , мускуль без вопросов стартует при загрузке системы по команде :

text

/usr/bin/mysqld_safe --skip-networking

и владельцем сокета является пользователь mysql !
7 . тогда сервер мускуля запущен и доступен для модификации , создавайте пользователей , рутов , базы , привелегии - пользуйте одним словом , что-как-и-почему в документации всё есть ..

*** больше ничего не могу вам сказать , так как дебианом не пользуюсь wink

#157773
StrongASB написал:
tmp - 755

это ни чего не значит :lol:
в отличие от других программ мускуль не использует /tmp для сокетов и временных файлов , у него своя обособленная территория , в Слаке это :
базы и вспомогательные файлы : /var/lib/mysql/
сокеты : /var/run/mysql/
владельцем должен быть пользователь mysql ..

#157784

gramozeka, как раз права на /tmp виноваты, я сейчас попробовал сделать 755 (должны быть 777), и получил ту же ошибку что и ТС:

text

Stopping MySQL database server: mysqld.
110501 23:04:45 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Can't create/write to file '/tmp/ibEubUyB' (Errcode: 13)
110501 23:04:45  InnoDB: Error: unable to create temporary file; errno: 13
110501 23:04:45 [ERROR] Plugin 'InnoDB' init function returned error.
110501 23:04:45 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Starting MySQL database server: mysqld.
Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly..

StrongASB, сделайте (от рута):

text
chmod -R 777 /tmp  

и повторите удаление \ установку.

#157789

[console]root@energypw:~# dpkg-reconfigure mysql-server-5.1
Stopping MySQL database server: mysqld.
Stopping MySQL database server: mysqld.
110501 15:16:18 [Note] Plugin 'FEDERATED' is disabled.
110501 15:16:18 InnoDB: Started; log sequence number 0 44233
110501 15:16:18 InnoDB: Starting shutdown...
110501 15:16:24 InnoDB: Shutdown completed; log sequence number 0 44233
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
root@energypw:~#
[/console]
[console]
root@energypw:~# mysqladmin -u root password mysqlrootpassword
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
root@energypw:~# mysqladmin -u root password 12
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
root@energypw:~#[/console]

#157790

При входе в phpmyadmin пишет:

Не удалось установить подключение для пользователя указанного в директиве controluser, с помощью параметров определенных в конфигурационном файле config.inc.php.
Войдите или зарегистрируйтесь, чтобы ответить.