编译好sql_db_plugin后启动nodeos
root@iZ2zea5mjpcmz9m17k56daZ:/home/surou/Documents/github/eos/build# nodeos --sql_db-uri=”mysql://db=eos user=root host=127.0.0.1 password='数据库密码' --sql_db-block-start=0 --delete-all-blocks
2018-07-25T12:39:28.628 thread-0 sql_db_plugin.cpp:81 set_program_options ] set_program_options
2018-07-25T12:39:28.629 thread-0 chain_plugin.cpp:271 plugin_initialize ] initializing chain plugin
2018-07-25T12:39:28.629 thread-0 chain_plugin.cpp:408 plugin_initialize ] Deleting state database and blocks
2018-07-25T12:39:28.721 thread-0 chain_plugin.cpp:508 plugin_initialize ] Starting up fresh blockchain with default genesis state.
2018-07-25T12:39:29.437 thread-0 http_plugin.cpp:344 plugin_initialize ] configured http to listen on 127.0.0.1:8888
2018-07-25T12:39:29.437 thread-0 net_plugin.cpp:2941 plugin_initialize ] Initialize net plugin
2018-07-25T12:39:29.437 thread-0 net_plugin.cpp:2966 plugin_initialize ] host: 0.0.0.0 port: 9876
2018-07-25T12:39:29.437 thread-0 net_plugin.cpp:3036 plugin_initialize ] my node_id is e5f1d9687a24d343c57e7ba32913db448147a2e9e7dc1fe12797a69c082e1c9a
2018-07-25T12:39:29.437 thread-0 wallet_plugin.cpp:42 plugin_initialize ] initializing wallet plugin
2018-07-25T12:39:29.437 thread-0 sql_db_plugin.cpp:96 plugin_initialize ] initialize
2018-07-25T12:39:29.437 thread-0 sql_db_plugin.cpp:104 plugin_initialize ] connecting to ”mysql://db=eos
2018-07-25T12:39:29.438 thread-0 main.cpp:141 main ] Failed to find shared library for backend ”mysql
报Failed to find shared library for backend ”mysql
错误。
查看EOS代码 eos\programs\nodeos\main.cpp:141
} catch( const std::runtime_error& e ) {
if( std::string(e.what()) == "database dirty flag set" ) {
elog( "database dirty flag set (likely due to unclean shutdown): replay required" );
return DATABASE_DIRTY;
} else if( std::string(e.what()) == "database metadata dirty flag set" ) {
elog( "database metadata dirty flag set (likely due to unclean shutdown): replay required" );
return DATABASE_DIRTY;
} else {
elog( "${e}", ("e",e.what())); // :141
}
return OTHER_FAIL;
} catch( const std::exception& e ) {
应该出在sql_db_plugin中的soci连接中
下载soci源代码
git clone https://github.com/SOCI/soci.git
查看错误出现在
// non-synchronized helper
void do_register_backend(std::string const & name, std::string const & shared_object)
{
// The rules for backend search are as follows:
// - if the shared_object is given,
// it names the library file and the search paths are not used
// - otherwise (shared_object not provided or empty):
// - file named libsoci_NAME.so.SOVERSION is searched in the list of search paths
soci_handler_t h = 0;
if (shared_object.empty() == false)
{
h = DLOPEN(shared_object.c_str());
}
else
{
// try system paths
h = DLOPEN(LIBNAME(name).c_str());
if (0 == h)
{
// try all search paths
for (std::size_t i = 0; i != search_paths_.size(); ++i)
{
std::string const fullFileName(search_paths_[i] + "/" + LIBNAME(name));
h = DLOPEN(fullFileName.c_str());
if (0 != h)
{
// already found
break;
}
}
}
}
if (0 == h)
{
throw soci_error("Failed to find shared library for backend " + name);
}
发现刚才出现此问题是因为输入的参数符号错误导致,问题停止跟进,以后在遇到类似的再跟进....