From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up MySQL on cRIO-9068

Hello,

I am trying to install MySQL on cRIO-9068.

I have successfully downloaded MySQL server package based on tutorials in this forum group but I started facing problems during installation process. At the end I have figured out that I have problem with permissions, when I try to start MySQL server manually I get the following error:

"admin@NI-cRIO-9068-194A3A5:/usr/bin# mysqld_safe

A141002 06:32:20 mysqld_safe Logging to '/var/log/mysqld.err'.

141002 06:32:20 mysqld_safe Starting mysqld daemon with databases from /var/mysql

141002 06:32:20 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld.pid ended"

When I check mysqld.err file I see the following error logged:

"141002 06:37:28 mysqld_safe Starting mysqld daemon with databases from /var/mysql

141002  6:37:28 [Warning] option 'myisam_max_extra_sort_file_size': unsigned value 2147483648 adjusted to 2147483647

141002  6:37:28 [Warning] /usr/libexec/mysqld: unknown option '--loose-skip-innodb'

141002  6:37:28 [ERROR] /usr/libexec/mysqld: Can't create/write to file '/var/lib/mysql/mysqld.pid' (Errcode: 13)

141002  6:37:28 [ERROR] Can't start server: can't create PID file: Permission denied

141002  6:37:28 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld.pid ended"

I am not experienced Linux user and I have no clue how to resolve this issue. Any ideas how to proceed?

Thanks for your help,

Regards

Franjo Tonkovic

Veski

0 Kudos
Message 1 of 7
(6,317 Views)

Here is the exceprt from my configration file that I put together for a project using the cRIO-9068 with LabVIEW 2013.  I do not know if this will work as expected in 2014.

# force opkg to pull down the updated list from the angstrom feed

opkg update

# we need to flag the libc6 package as 'okay' to upgrade.  This *can* be dangerous,

# but appears to be acceptable via NI forums.

opkg flag ok libc6

# upgrade libc6 to 2.12 from 2.11

opkg upgrade libc6

# install mysql

opkg install mysql

# install the mysqlclient lib 16 (note: this probably should be recompiled against 14, but it works for the time being)

opkg install libmysqlclient16

# add the mysql user so our mysql server can run in a permissions sandbox

useradd mysql

# give access to the folders that mysqld uses to hold config info and the database files

chown -R mysql:mysql /var/mysql/

chown -R mysql:mysql /var/lib/mysql/

# init the mysql database instance

/usr/bin/mysql_install_db

# create a soft link to the server executable in the init.d folder so that it is launched

# on system boot.  This way we do not have to start it manually.  Note: since all VI's

# appear to run under the lvuser login, we can not launch the server (the lvuser user does

# not have enough permissions to run the server), so the server needs to be launched from

# the prompt, or via this method using init.d.

cd /etc/init.d

ln -s /usr/bin/mysqld_safe

It look waaaaaay too long to figure that out, so hopefully that helps you with your problem.  Good luck.

-TD

0 Kudos
Message 2 of 7
(3,898 Views)

Perhaps I should have given a bit more direction.

1) Login to your cRIO-9068 via SSH as admin

2) Execute all of the commands listed above at the prompt

3) Restart our cRIO-9068

4) connect to the mysql instance using the mysql command at the prompt.

Hope that helps.

-TD

0 Kudos
Message 3 of 7
(3,898 Views)

Hi,

Thanks for your suggestions.

Actually I have performed most of the steps you have suggested except :

opkg upgrade libc6

chown -R mysql:mysql /var/mysql/

chown -R mysql:mysql /var/lib/mysql/

I was hoping these steps will resolve my issue but unfortunately they didn't. I still have the same problem.

If I try to start MySQL server manually I still get the error related to permissions:

admin@NI-cRIO-9068-194A3A5:/usr/bin# mysqld_safe

141002 23:25:15 mysqld_safe Logging to '/var/log/mysqld.err'.

141002 23:25:15 mysqld_safe Starting mysqld daemon with databases from /var/mysql

141002 23:25:15 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld.pid ended

Btw, I am also using LV 2013... although not sure if it matters for MySQL installation.

Regards

Franjo

0 Kudos
Message 4 of 7
(3,898 Views)

Btw, I am also using LV 2013... although not sure if it matters for MySQL installation.

Maybe it does, although I'm not aware of any specific reason why it would matter. For me, on 2014, I was able to do simply:

admin@scot-9068:~# useradd mysql

admin@scot-9068:~# opkg install mysql5

[bunch of progress output]

Configuring mysql5.

141008 20:25:44 mysqld_safe Logging to '/var/log/mysqld.err'.

141008 20:25:44 mysqld_safe Starting mysqld daemon with databases from /var/mysql

admin@scot-9068:~# ls -ld /var/mysql

drwx------    4 mysql    administ       288 Oct  8 20:41 /var/mysql

admin@scot-9068:~# cat /var/log/mysqld.err

141008 20:41:42 mysqld_safe mysqld from pid file /var/lib/mysql/mysqld.pid ended

141008 20:41:47 mysqld_safe Starting mysqld daemon with databases from /var/mysql

141008 20:41:47 [Warning] option 'myisam_max_extra_sort_file_size': unsigned value 2147483648 adjusted to 2147483647

141008 20:41:47 [Warning] /usr/lib/mysql5/mysqld: unknown option '--loose-skip-innodb'

141008 20:41:47 [Note] Event Scheduler: Loaded 0 events

141008 20:41:47 [Note] /usr/lib/mysql5/mysqld: ready for connections.

Version: '5.1.40'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution

admin@scot-9068:~# mysql -D test

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.1.40 Source distribution

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

mysql>

At that point I did a sanity check of some basic mysql commands, create a table, insert, select, etc., which worked as expected.

Note I didn't have to make or chown any directories. I also didn't have to run mysqld_safe myself -- it appears the install process started the daemon for me, and also added it to rc5.d so it should run at startup. It also looks like it ran mysql_install_db for me (was part of the install output I snipped above).

I see that it is at least slightly different between 2013 and 2014 in that you guys are installing "mysql" and there's no such package in 2014 -- just a bunch of "mysql5" packages. While I think it should work in 2013, maybe 2014 makes life simpler enough that it's worth trying with 2014. Is that an option for you?

0 Kudos
Message 5 of 7
(3,898 Views)

Hi,

I have figured out what was the problem in my case. It was not related to LV 2013, but it was caused by the way how I have created user "mysql".

Before I have asked your for help and I got your notes, I have created user "mysql" on cRIO-9068 from web UI. After I  have executed command "useradd mysql" on  cRIO, I was getting message that the user already exists and I didnt concider that as a problem.

But later I have figured that creation of user from MAX does not create user subfolder in the folder \home as command

"useradd mysql".

So after deleting user mysql in web UI and executing command "useradd mysql" on the target, things started to work for me.

Btw. Veski still uses LV 2011 SP1 for on-site installations and I am currently using LV2013 just for evaluating capabilities of cRIO-9068, but we generally consider to upgrade our code to LV 2014.

Thanks for your help,

Regards

Franjo Tonkovic

Veski

0 Kudos
Message 6 of 7
(3,898 Views)

hi, i saw your question, and i was tryng to install mySQL server in cRIO 9031, but i am having troubles, can you showme some tutorial or anything that could help me

 

tankyou

0 Kudos
Message 7 of 7
(3,243 Views)