mysql ERROR 2002 (HY000)

Установка, настройка, поддержка
Ответить
bulick08
Сообщения: 23
Зарегистрирован: Сб фев 17, 2007 10:43 am
Контактная информация:

mysql ERROR 2002 (HY000)

Сообщение bulick08 »

я в linuxe ламер так что попрошу рассказыать поподробнее. У мну такая проблемка возникла после установки mysql-4.1.16 как сказано в инсрукцыи создал файл pre_abills.sql(кстате как его надобыло сздавать?) через консоль прописыаю

mysql -u root -p < pre_abills.sql

и оно мне ыдаёт

[root@localhost mysql-4.1.16]# mysql -u root -p < pre_abills.sql
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

что это значит и что мне с этим делать?
Кстате подскажите плиз какой там пароль надо было вводить?

Заранее всемочень благодарен!!!

lite
Сообщения: 23
Зарегистрирован: Вс янв 28, 2007 6:17 am

Сообщение lite »

"mysql -u root -p < pre_abills.sql "
Что к чему?

У тебя mysqld запущен ? Что показывает :
# mysqladmin
и
# ps auwx| grep mysql ?

bulick08
Сообщения: 23
Зарегистрирован: Сб фев 17, 2007 10:43 am
Контактная информация:

Сообщение bulick08 »

на счёт того что зопущено я ничего не знаю... с mysql делал только следующееЖ:
tar xvfz mysql-4.1.16.tar.gz
cd mysql-4.1.16
./configure --prefix=/usr
make
make install

Создаем файл pre_abills.sql следующего содержания:
use mysql;
INSERT INTO user (Host, User, Password) VALUES ('%','abills',password('sqlpassword'));
INSERT INTO db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Index_priv, Alter_priv) VALUES ('localhost', 'abills', 'abills', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
CREATE DATABASE abills;

далее (по инструкции)написано что надо создать пользователя и пароль как это делать я не знаю пытался в консоли писать следующее
mysql -u root -p < pre_abills.sql
оно запрашивает пароль о котором я спрашивал
а потом выдаёт
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

lite
Сообщения: 23
Зарегистрирован: Вс янв 28, 2007 6:17 am

Сообщение lite »

Всё ровно хотелось бы видеть, что показывают команды:
# mysqladmin
и
# ps auwx| grep mysql

Проверь есть ли у тебя группа (/etc/group) и пользователь mysql.
Если нету то создай:
# groupadd mysql
# useradd -g mysql mysql

Судя по всему ты не проинициализировал первичную базу mysql-я

#mysql_install_db --user=mysql
объязательно с параметром --user=mysql !

Теперь можешь запустить MySQL командой /usr/mysql/bin/safe_mysqld start

После чего сделай автозапуск mysqld.
Для этого в файл /etc/rc.d/rc.local нужно добавить:
/usr/mysql/bin/safe_mysqld &

bulick08
Сообщения: 23
Зарегистрирован: Сб фев 17, 2007 10:43 am
Контактная информация:

Сообщение bulick08 »

[root@localhost mysql-4.1.16]# mysqladmin
mysqladmin Ver 8.41 Distrib 4.1.16, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Administration program for the mysqld daemon.
Usage: mysqladmin [OPTIONS] command command....
-c, --count=# Number of iterations to make. This works with -i
(--sleep) only.
-#, --debug[=name] Output debug log. Often this is 'd:t:o,filename'.
-f, --force Don't ask for confirmation on drop database; with
multiple commands, continue even if an error occurs.
-C, --compress Use compression in server/client protocol.
--character-sets-dir=name
Directory where character sets are.
--default-character-set=name
Set the default character set.
-?, --help Display this help and exit.
-h, --host=name Connect to host.
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's asked from the tty.
-P, --port=# Port number to use for connection.
--protocol=name The protocol of connection (tcp,socket,pipe,memory).
-r, --relative Show difference between current and previous values when
used with -i. Currently works only with extended-status.
-O, --set-variable=name
Change the value of a variable. Please note that this
option is deprecated; you can set variables directly with
--variable-name=value.
-s, --silent Silently exit if one can't connect to server.
-S, --socket=name Socket file to use for connection.
-i, --sleep=# Execute commands again and again with a sleep between.
-u, --user=name User for login if not current user.
-v, --verbose Write more information.
-V, --version Output version information and exit.
-E, --vertical Print output vertically. Is similar to --relative, but
prints output vertically.
-w, --wait[=#] Wait and retry if connection is down.
--connect_timeout=#
--shutdown_timeout=#

Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- -----------------------------
count 0
force FALSE
compress FALSE
character-sets-dir (No default value)
default-character-set (No default value)
host (No default value)
port 3306
relative FALSE
socket (No default value)
sleep 0
user (No default value)
verbose FALSE
vertical FALSE
connect_timeout 43200
shutdown_timeout 3600

Default options are read from the following files in the given order:
/etc/my.cnf /usr//var/my.cnf ~/.my.cnf
The following groups are read: mysqladmin client
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit
--no-defaults Don't read default options from any options file
--defaults-file=# Only read default options from the given file #
--defaults-extra-file=# Read this file after the global files are read

Where command is a one or more of: (Commands may be shortened)
create databasename Create a new database
debug Instruct server to write debug information to log
drop databasename Delete a database and all its tables
extended-status Gives an extended status message from the server
flush-hosts Flush all cached hosts
flush-logs Flush all logs
flush-status Clear status variables
flush-tables Flush all tables
flush-threads Flush the thread cache
flush-privileges Reload grant tables (same as reload)
kill id,id,... Kill mysql threads
password new-password Change old password to new-password, MySQL 4.1 hashing.
old-password new-password Change old password to new-password in old format.

ping Check if mysqld is alive
processlist Show list of active threads in server
reload Reload grant tables
refresh Flush all tables and close and open logfiles
shutdown Take server down
status Gives a short status message from the server
start-slave Start slave
stop-slave Stop slave
variables Prints variables available
version Get version info from server
[root@localhost mysql-4.1.16]# ps auwx| grep mysql
root 1377 0.0 0.4 1772 608 pts/0 R 12:16 0:00 grep mysql

bulick08
Сообщения: 23
Зарегистрирован: Сб фев 17, 2007 10:43 am
Контактная информация:

Сообщение bulick08 »

[root@localhost mysql-4.1.16]# mysql_install_db --user=mysql
Installing all prepared tables
Fill help tables
ERROR: 1064 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 '' at line 1
070219 12:19:44 [ERROR] Aborting

070219 12:19:44 [Note] /usr//libexec/mysqld: Shutdown complete

/usr/bin/mysql_install_db: line 299: 1762 Broken pipe cat $fill_help_tables

WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!
The "HELP" command might not work properly


To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr//bin/mysqladmin -u root password 'new-password'
/usr//bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/ ; /usr//bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr//bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

lite
Сообщения: 23
Зарегистрирован: Вс янв 28, 2007 6:17 am

Сообщение lite »

Код: Выделить всё

default-character-set (No default value) 
host (No default value) 
port 3306 
найди фаил my.cnf (по умолчанию /etc/my.cnf) и впиши сторчку "socket = /tmp/mysql.sock", что бы выглядело примерно так:

Код: Выделить всё

[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock
                                               
# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
Если такого файла нету, то создай его, содержимое файла:

Код: Выделить всё

[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
myisam_sort_buffer_size = 8M

#skip-networking
log-bin
server-id       = 1

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/var/
innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/var/
#innodb_log_arch_dir = /usr/local/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
#max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
Посмотри создались ли папка /usr/mysql/var/db/mysql и кто владелец:
# ls -l mysql
Если владелец root, смени на mysql:
# chown -R mysql /usr/mysql/var/db/mysql

Затем запусти mysql:
# /usr/mysql/bin/safe_mysqld start
и попробуй подключиться:
#mysql -u root -p

Если всё заработает, пропиши авторестарт и можешь работать базой.

Вообще не факт, что всё это поможет. Где-нибуть будет указан неверный путь или что-то не так сделаешь, поэтому советую удалить порт и поставить mysql из пакета, меньше мароки будет.

lite
Сообщения: 23
Зарегистрирован: Вс янв 28, 2007 6:17 am

Сообщение lite »

Только вначале поставь клиента, а потом сервер MySQL-я.

bulick08
Сообщения: 23
Зарегистрирован: Сб фев 17, 2007 10:43 am
Контактная информация:

Сообщение bulick08 »

я извиняюсь конечно а что за клиент то где его взять и как его ставить?

lite
Сообщения: 23
Зарегистрирован: Вс янв 28, 2007 6:17 am

Сообщение lite »

MySQL использует технологию "клиент-сервер". Клиент необходим для подключения к серверу mysql. Т.е. работать с базой можно только через клиента.

Не знаю что означает эта надпись:

Код: Выделить всё

tar xvfz mysql-4.1.16.tar.gz
либо это сервер, либо сервер и клиент :? .



Но пакеты выглядят так, покрайне мерие rpm:

MySQL-client-4.1.16-1.i386.rpm
MySQL-server-4.1.16-1.i386.rpm

bulick08
Сообщения: 23
Зарегистрирован: Сб фев 17, 2007 10:43 am
Контактная информация:

Сообщение bulick08 »

кажется я понял в чём может быть проблема!!! у меня стоял mysql родной я его не трогая постаил новый!!!

подскажите плиз ЛАМЕРУ как удалить!!! или подскажите где мона читнуть. я поисковиками конечно пользоватся умею но пока ничего путёого не нашёл!

СПАСИБО!!!!!!!!!

Ответить