A
A
Alexander Bulatov2019-03-01 17:20:30
Sphinx
Alexander Bulatov, 2019-03-01 17:20:30

Why is Indexer (from Sphinx Search Engine) throwing an "Access Denied" error?

Good day!
I'm trying to install Sphinx on a server.
I made a command in the Shell client
yum install sphinx
Then I corrected the config file, this is how it began to look:

#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source industry
{
    # тип источника, в данном случае БД MySQL
  type			    = mysql

  # Параметры подключения к БД
  sql_host		    = localhost
  sql_user		    = root
  sql_pass		    = --пароль--
  sql_db			    = industry
  sql_port		    = 3306    # optional, default is 3306

  # запрос или запросы, которые будут выполнены после установки соединения с базой данных
  sql_query_pre       = SET NAMES utf8 COLLATE utf8_unicode_ci
#	sql_attr_uint = group_id
}

# пример наследования source , который наследуется от другого source
source in_publication: industry
{
  sql_query           = SELECT * FROM in_publication
 
  #здесь вы должны указать по каким полям будете группировать результаты, 
  #лучше указать все которые были перечислены сверху, тогда выглядеть будет логично
  #type of group fields
#	sql_field_string = id
#	sql_field_string = title
#	sql_field_string = annotation
}

source in_company: industry
{
  sql_query           = SELECT *  FROM in_company_info
 
  #здесь вы должны указать по каким полям будете группировать результаты, 
  #лучше указать все которые были перечислены сверху, тогда выглядеть будет логично
  #type of group fields
  
#	sql_field_string = id
#        sql_field_string = name
#        sql_field_string = annotation
}

source in_used_equipment: industry
{
  sql_query           = SELECT * FROM in_used_equipment
}

source in_used_equipment_buy: industry
{
  sql_query           = SELECT * FROM in_used_equipment_buy
}


index used_equipment
{
  source 			    = in_used_equipment

  # Путь по которому будут сохранены файлы индекса
  path			    = /var/lib/sphinx/used_equipment

  # тип хранения атрибутов индекса
  docinfo			    = extern

  # морфологический препроцессор
  morphology		    = stem_enru, Soundex, Metaphone

  # минимальная длина индексируемого слова
  min_word_len        = 1

    expand_keywords     = 1
    index_exact_words   = 1
    min_infix_len       = 3

    # звездочки в запросах, например *борон* => оборона, борона
    enable_star         = 1
}

index used_equipment_buy
{
    source              = in_used_equipment_buy
    path                = /var/lib/sphinx/used_equipment_buy
    docinfo             = extern
    morphology          = stem_enru, Soundex, Metaphone
    min_word_len        = 1
    expand_keywords     = 1
    index_exact_words   = 1
    min_infix_len       = 3

    # звездочки в запросах, например *борон* => оборона, борона
    enable_star         = 1
}


index publication
{
  source        		= in_publication
  	path          		= /var/lib/sphinx/test3
  	docinfo      		= extern
  morphology		    = stem_enru, Soundex, Metaphone
  min_word_len		= 1
  expand_keywords		= 1
  index_exact_words	= 1
  min_infix_len		= 3

  # звездочки в запросах, например *борон* => оборона, борона
    enable_star         = 1
}


index company
{
  source			    = in_company
  path          		= /var/lib/sphinx/test4
  morphology		    = stem_enru, Soundex, Metaphone
  min_word_len		= 1
  expand_keywords		= 1
  index_exact_words	= 1
  min_infix_len		= 3
  docinfo			    = extern

  # звездочки в запросах, например *борон* => оборона, борона
    enable_star         = 1
}

indexer
{
    # лимит памяти для работы индексатора
  mem_limit		    = 128M
}


searchd
{
  listen              = 9312:sphinx       # порт для работы через API
  listen              = 9306:mysql41      # порт для комуникаций с MySQL
  log                 = /var/log/sphinx/searchd.log
  query_log           = /var/log/sphinx/query.log
  read_timeout        = 5
  max_children        = 30
  pid_file            = /var/run/sphinx/searchd.pid
  seamless_rotate     = 1
  preopen_indexes     = 1
  unlink_old          = 1
  binlog_path         = /var/lib/sphinx/
}

After I start the Indexer with the command
indexer --all
And I get the following:
Sphinx 2.1.5-id64-release (rel21-r4508)                                                        
Copyright (c) 2001-2014, Andrew Aksyonoff                                                      
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)                     
                                                                                               
using config file '/etc/sphinx/sphinx.conf'...                                                 
indexing index 'used_equipment'...                                                             
ERROR: index 'used_equipment': sql_connect: Access denied for user 'root'@'localhost' (using pa
ssword: YES) (DSN=mysql://root:***@localhost:3306/industry).                                   
total 0 docs, 0 bytes                                                                          
total 0.009 sec, 0 bytes/sec, 0.00 docs/sec                                                    
indexing index 'used_equipment_buy'...                                                         
ERROR: index 'used_equipment_buy': sql_connect: Access denied for user 'root'@'localhost' (usin
g password: YES) (DSN=mysql://root:***@localhost:3306/industry).                               
total 0 docs, 0 bytes                                                                          
total 0.000 sec, 0 bytes/sec, 0.00 docs/sec                                                    
indexing index 'publication'...                                                                
ERROR: index 'publication': sql_connect: Access denied for user 'root'@'localhost' (using passw
ord: YES) (DSN=mysql://root:***@localhost:3306/industry).                                      
total 0 docs, 0 bytes                                                                          
total 0.000 sec, 0 bytes/sec, 0.00 docs/sec                                                    
indexing index 'company'...                                                                    
ERROR: index 'company': sql_connect: Access denied for user 'root'@'localhost' (using password:
 YES) (DSN=mysql://root:***@localhost:3306/industry).                                          
total 0 docs, 0 bytes                                                                          
total 0.000 sec, 0 bytes/sec, 0.00 docs/sec                                                    
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg                                   
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

And when you try to log into MySQL through the Shell client, the login and access are not denied - it lets you in!
Therefore, something in the config was not added or something else.
Therefore, I will be glad to any thought, advice or parting words.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2019-03-02
@alexanderbulatov

Well, it's obvious that the password is wrong or you have a local root login without a password

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question