how to set environment variable for MariaDB version 10.1.21 database in Linux mint system - mysql

How to set environment variable for MariaDB database version 10.1.21 in Linux mint operating system and after setting environment variable how I check the variable is set or not.
I tried below command but didn't work.
export PATH=${PATH}:/usr/local/mysql/bin/
Thanks for your help !

The syntax is fine but export command will create environment variables for the current shell only. Each child process of that shell will recognize the added variable.
In order to set an environment variable permanently for a particular user you should add the line:
PATH=${PATH}:/usr/local/mysql/bin/
into the file ~/.bashrc or ~/.bash_profile
Further if you want to add for all users (in special cases), you can add that line to in system-wide configuration files present in following directories and files: /etc/environment, /etc/profile, /etc/profile.d/, /etc/bash.bashrc.
These variables are loaded every time system is powered on and logged in either locally or remotely by any user.

Related

Problem with the command-line JSON processor JQ in Windows 10, 64 bit

I have downloaded the program jq-win64.exe from 'https://stedolan.github.io/jq/' and installed the program in a folder C:\Program Files\jq\ on my computer.
I have also added the PATH to the program to the end of the systemvariable string in Windows 10 : . . . ;C:\Program Files\curl\;C:\Program Files\jq\
In one terminal window in Visual Studio Code I am running a server.
In another terminal window I am trying to execute the command curl -s localhost:3000 | jq
Terminal window 1:
C:\Users\SteinarV\PROFF_JAVASCRIPT\PROJECT\smartHouse
node server.js
API running on port 3000
Terminal window 2:
C:\Users\SteinarV\PROFF_JAVASCRIPT\PROJECT\smartHouse>curl -s localhost:3000 | jq
'jq' is not recognized as an internal or external command,
operable program or batch file
... and do not understand why jq is not recognized.
Can someone help ?
I have downloaded the program jq-win64.exe from 'https://stedolan.github.io/jq/' and installed the program in a folder C:\Program Files\jq\ on my computer.
As you have indicated, you have a file called jq-win64.exe but you are trying to execute the command jq. You either need to rename the file to jq.exe or you need to use the command jq-win64.
For a detailed explanation of how Windows finds and executes a program in your path when you enter a command, see The Windows NT Command Shell: Command Search Sequence. Specifically:
...The shell now searches each directory specified by the PATH environment variable, in the order listed, for an executable file matching the command name. If a match is found, the external command (the executable file) executes...
...If the command name does not include a file extension, the shell adds the extensions listed in the PATHEXT environment variable, one by one, and searches the directory for that file name. Note that the shell tries all possible file extensions in a specific directory before moving on to search the next directory (if there is one)...
You indicate in the comments the same error persists even when the filenames match. Note that each running program has its own set of environment variables, and these aren't updated by global changes. You need to close and reopen cmd.exe windows after making a global change. See also Adding directory to path environment variable in windows. You can use the path command to verify whether a particular terminal session has inherited the PATH variable you defined, thus narrowing your problem.
You indicate that the problem still persists. You need to use the tools available to you to narrow it down further:
Try running the program with its full path:
"C:\Program Files\jq\jq-win64.exe" --help
This will confirm that the program is present where you think it is and can be run from the terminal.
Try running the program with no path and its extension:
jq-win64.exe --help
If this works but running the program without an extension doesn't, you might have set PATHEXT to something that doesn't include ".EXE".
Try setting the path explicitly in the terminal to contain only the program directory and nothing else, then run it with its full extension:
set PATH=C:\Program Files\jq
jq-win64.exe --help
(Note that after this test you'll need to close the terminal window and start a new one to reset the path.)
If this works, perhaps you have a mismatch in your path.

How to setup multiple environments (dev\stage\production) with elastic beanstalk?

I need to do the following
Change environment variables according to the published env. Set Set up cron jobs according to the dev. I I would like to run just 1 command line "eb deploy dev" or something similar.
Use setenv
You can set environment variables with setenv. These will then be remembered for that environment.
More details: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-setenv.html
Example
For example, suppose you have created an EB environment called 'staging' and you want to set the variable DB to 'localhost', you can use:
eb setenv DB=localhost -e staging
Crons
Now that you have a different environment variables, you can check them in a script etc. to decide if the cron should be set up.
Note that the crons may not actually have access to your environment variables so you need to set those again for the cron while setting up the cron.
This is my solution to the problem, it took some time to setup but now i can do all the changes with 1 command line.
Make your own folder with all the files for all the environments.
In .ebextensions folder setup empty config files for eb.
npm runs a script named "deploy.js" together with the flag of the specific env.
The script will do the following
copy the requested env data to the empty files according to the env
git stash the changes of .ebextensions folder (eb deploys using git)
eb use env
eb deploy
So now i can tun npm run deploy:dev and everything runs

PHP Mysql laravel 5.4 terminal issue

i am new to laravel i just figured out how to install composer laravel etc etc on my local machine MAMP on windows , Now i am confuse with the command on terminal which is
C:\project>mysql -uroot -proot
'mysql' is not recognized as an internal or external command,
operable program or batch file.
How can i fix this ?
setting Environment will solve the issue
Go to Control Panel -> System -> Advanced
Click - Environment Variables
Go to- System Variables find PATH and click on it.
add the path to your mysql\bin folder to the end paths. (ex: E:\xampp\mysql\bin) and add ; end of the line
Close all the command prompts you opens.
Re open and try it.
Setting the PATH to point to the MYSQL bin folder is normally the first thought, but I find that dangerous as things get left lying around when you change software.
I normally create a little batch file in the projects folder or in a folder that it already on your PATH, like this
mysqlpath.cmd
echo off
PATH=C:\mamp\path\to\the\mysql\bin;%PATH%
mysql -v
The mysql -v will output the mysql version number but it is a handy way of knowing that the correct folder has been added to the PATH. This adds the folder to the PATH but only for the life of the command window.
Then just run this from any command window when you want to use MYSQL from the command line
> phppath
You may also like to create one for PHP as well
phppath.cmd
echo off
PATH=C:\mamp\path\to\the\php\;%PATH%
php -v

How can I make a MySQL Script to run automatically whenever a the MySQL Server reboots on a Linux environment

I'd like to automatically populate Memory tables each time the MySQL Server reboots. Is there a way I can set a trigger which is based on that event? Or a script which is run by either the Mysqd or mysqld_safe startup scripts?
Thanks in advance
You can use the below startup script for linux :
add the followin in init.d file.
vi /etc/init.d/ you have to set it executable with: chmod +x /etc/init.d/start_my_app And dont forget to add #!/bin/sh on top of that file
And put the complete location of your script in it, like /var/myscripts/test.php instead of just start_my_app
in test.php page you can have mysql query executed.
You can set a command line option "--init-file=file_name" whenever mysql start
--init-file=file_name
Command-Line Format --init-file=file_name
Option-File Format init-file
Read SQL statements from this file at startup. Each statement must be on a single line and should not include comments.
This option is unavailable if MySQL was configured with the --disable-grant-options option.
Source : Mysql developer Documentation
For More Detail
http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_init-file

Why can't I run my Perl job in Hudson?

I tried to do this in Hudson but:
I have a script in Perl on my server (windows): lets say: d\util\demo.pl I want to have it running in Hudson. so I go to Hudson, create new job, go to: Build Execute Windows batch command and add: perl.exe d\util\demo.pl
I got this error: 'perl.exe' is not recognized as an internal or external command, operable program or batch file.
please help!
It can't find the perl.exe in the path of the agent that is running the task. Verify that perl is properly installed AND that the path where perl.exe was in stalled to is in you system path on EVERY agent that will run this task.
Can you run that command from any folder of the server?
If yes, than the Hudson server runs definitely under a different user account. Make sure that the user account Hudson is running under has all necessary environment variables set.
If not, than add the full qualified path to the perl.exe (e.g. C:\program files\perl\bin\perl.exe d:\util\demo.pl). If this doesn't help, you have to also set all environment variables (see "if yes").