Jump to content
iwato

Installing MeCab

Recommended Posts

 

More multi-tasking

BACKGROUND:  I discovered the following passage at <https://dev.mysql.com/doc/refman/5.7/en/fulltext-search-mecab.html> and would like to know clearly what it means

Quote

You can install mecab and mecab-ipadic using a native package management utility (on Fedora, Debian, and Ubuntu), or you can build mecab and mecab-ipadic from source. For information about installing mecab and mecab-ipadic using a native package management utility, see Installing MeCab From a Binary Distribution (Optional). If you want to build mecab and mecab-ipadic from source, see Building MeCab From Source (Optional)

The reasons that I do not understand it are several, but the primary results from this discovery within my on system.

/usr/lib64/mysql/plugin/libpluginmecab.so
/usr/lib64/mysql/mecab

The above suggests that MeCab is already installed, does it not?

However, when I try to alter my current table to accommodate the MeCab functionality, I am rejected with an error that reads MeCab is undefined.

This suggests that it is not installed.

Please advise.

Roddy

 

Share this post


Link to post
Share on other sites

You have a shared object file, I don't know if that means it's installed or if you still need to enable it somehow.  Make sure you follow all of the installation instructions after just getting the files.

Share this post


Link to post
Share on other sites

Much research and exploration later I believe that all I really have to do is connect the dots.  In

https://dev.mysql.com/doc/refman/8.0/en/fulltext-search-mecab.html

I am told

Quote

In the MySQL configuration file, set the mecab_rc_file configuration option to the location of the mecabrc configuration file, which is the configuration file for MeCab. If you are using the MeCab package distributed with MySQL, the mecabrc file is located in MYSQL_HOME/lib/mecab/etc/.

Now, I have discovered the location of mecabrc

/usr/lib64/mysql/mecab/etc/mecabrc

Also, I have found something called

/usr/bin/mysql_config_editor

This program is in the same folder as mysql and the mysql_config and mysql_config-64 files

Further, I have been told

Quote

In the MySQL configuration file, set the mecab_rc_file configuration option to the location of the mecabrc configuration file, which is the configuration file for MeCab. If you are using the MeCab package distributed with MySQL, the mecabrc file is located in MYSQL_HOME/lib/mecab/etc/.

            [mysqld]
            loose-mecab-rc-file=MYSQL_HOME/lib/mecab/etc/mecabrc

Further, the help manual to the mysql_config_editor provides the following

MySQL Configuration Utility.
    Usage: mysql_config_editor [program options] [command [command options]]
    -#, --debug[=#]     This is a non-debug version. Catch this and exit.
    -?, --help          Display this help and exit.
    -v, --verbose       Write more information.
    -V, --version       Output version information and exit.

    Variables (--variable-name=value)
    and boolean options {FALSE|TRUE}  Value (after reading options)
    --------------------------------- ----------------------------------------
    verbose                           FALSE

    Where command can be any one of the following :
     set [command options]     Sets user name/password/host name/socket/port for a given login path (section).
	 remove [command options]  Remove a login path from the login file.
	 print [command options]   Print all the options for a specified login path.
     reset [command options]   Deletes the contents of the login file.
     help                      Display this usage/help information.

Now I am inclined to call the mecab_config_editor with the following command, but am unsure how to interpret MYSQL_HOME

/usr/bin/mecab_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab/etc/mecabrc

relative to /usr/bin/mysql

QUESTION:  How would you write the above mecab_config_editor command?  Or, would you do something completely different?

Roddy

 

 

Share this post


Link to post
Share on other sites

I've always just edited the config files directly, just make sure to restart the mysql service after doing so.  I would guess that MYSQL_HOME is an environment variable, otherwise it's the location where MySQL is installed.  

Share this post


Link to post
Share on other sites
Quote

I would guess that MYSQL_HOME is an environment variable, otherwise it's the location where MySQL is installed. 

And, if it is the location, how would you write it relative to /usr/bin/mysql?  Or, would you use an absolute URL?  Or, does it even make a difference?

Also, I have chosen to use the mysql_config_editor, because I am not permitted to enter the required directories with my usual editing software.  Moreover, I do not want to learn still another Terminal editor; they are simply cumbersome and so infrequently used.  I would venture to guess that this is the reason mysql_config_editor was created.

Roddy

Share this post


Link to post
Share on other sites

If it's an environment variable and it's set correctly then you don't have to do anything.  Otherwise, if you want to replace it with an actual path, then figure out the installation path and use that.  Make sure that, whatever you replace it with, that MYSQL_HOME/lib/mecab/etc/mecabrc points to something that exists.

Moreover, I do not want to learn still another Terminal editor; they are simply cumbersome and so infrequently used.

It's a text file, you can use any text editor.  If you don't have one, look at Sublime Text.

Share this post


Link to post
Share on other sites
Quote

Otherwise, if you want to replace it with an actual path, then figure out the installation path and use that. 

Installation path?

I think in terms of relative and absolute paths.  What exactly do you mean by installation path?

In any case, the problem in utmost clarity is the following:

The Absolute Path to the mecabrc File is:
/usr/lib64/mysql/mecab/etc/mecabrc

The Absolute Path to the MySQL Application is:
/usr/bin/mysql 

What I want to know is how to fill in MYSQL_HOME in the phrase

	MYSQL_HOME/lib/mecab/etc/mecabrc

as designated by the following MySQL directive:

	/usr/bin/mysql_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab/etc/mecabrc

Roddy

Share this post


Link to post
Share on other sites

What exactly do you mean by installation path?

The path where the software is installed...

Share this post


Link to post
Share on other sites

The Absolute Path to the mecabrc File is:
/usr/lib64/mysql/mecab/etc/mecabrc

The Absolute Path to the MySQL Application is:
/usr/bin/mysql

What I want to know is how to fill in MYSQL_HOME in the phrase

    MYSQL_HOME/lib/mecab/etc/mecabrc

as designated by the following MySQL directive:

    /usr/bin/mysql_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab /etc/mecabrc

Could you write the phrase based upon what is given?


Roddy

Share this post


Link to post
Share on other sites

Do you understand what an environment variable is?  Why do you think you need to replace MYSQL_HOME with something else?

This thread is going on for a while, so let me just try to be as clear as possible: you need to update the MySQL config file with the path to the mecabrc file.  I don't know what that path is.  It's not my computer.  Find the file, determine the path, and update the config file.  That's all.  If you don't know if MYSQL_HOME is defined or don't want to use it, then don't use it.

Share this post


Link to post
Share on other sites

Firstly, thank you for your response.

Now, I understand what an environmental variable is.  Unfortunately, the environmental variable MYSQL_HOME is not defined for my system.  The MySQL statements mysqladmin global variables and mysqladmin variables show no variable with the name MYSQL_HOME, and the list for each statement is quite long.

Please consider carefully the following and advise again:

 The Absolute Path to the mecabrc File is:
/usr/lib64/mysql/mecab/etc/mecabrc

The Absolute Path to the MySQL Application is:
/usr/bin/mysql

What I want to know is how to fill in MYSQL_HOME in the phrase

    MYSQL_HOME/lib/mecab/etc/mecabrc

as designated by the following MySQL directive:

    /usr/bin/mysql_config_editor loose-mecab-rc-file=MYSQL_HOME/lib/mecab /etc/mecabrc

Could you write the phrase based upon what is given?

Roddy

 

Share this post


Link to post
Share on other sites

Find the file, determine the path, and update the config file.  That's all.

Share this post


Link to post
Share on other sites

OK.  So, how would you determine the "install path" of any installation, if you yourself did not perform the installation?

Roddy

 

Share this post


Link to post
Share on other sites

Seems like you already did:

The Absolute Path to the mecabrc File is:
/usr/lib64/mysql/mecab/etc/mecabrc

You can also use a find or search utility to look for a specific filename anywhere on your computer.

I mean, I never explicitly installed the Windows Notepad application, but if I wanted to find where it was installed it wouldn't be that difficult to search for notepad.exe on my filesystem.

Share this post


Link to post
Share on other sites

Thank you.  Yes, really that was all that I was asking.

Now, I recall sometime back that you recommended a terminal editor that would not cost me and arm and leg in learning costs.  What was it again, please?

Roddy

Share this post


Link to post
Share on other sites

Please ignore this question.  I just discovered the source of my problem.  I was not logging in at the top of folder hierarchy.

Yes, that was it.  Will it, however, overcome the problem that I am having accessing my hostserver?

Write now I am working with both BBEdit and FETCH, but am limited in my ability to access those folders closest to my root. 

Roddy

Edited by iwato

Share this post


Link to post
Share on other sites

If you're talking about the server that you have an account on, you're limited to only accessing your home directory, nothing outside of that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×