changing $PATH by editing .bash_profile - mysql

I am having some trouble changing my $PATH variable to include my recent mysql install. This is what I did. In a terminal session (using the zsh shell) I typed
nano .bash_profile
Inside of this file I put
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I exit, save, and when I type
cat .bash_profile
I can see the file was edited properly but when I close the terminal session, open a new window, and type
echo $PATH
I get the following:
/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/texbin
So not only is my new mysql path not in there but it didn't change at all. It must be saved in a different file besides .bash_profile correct? Any ideas which one?
Thanks in advance

The correct way to add paths to the environment in OS X is to create entries in /etc/paths.d, so in this case you might put "/usr/local/mysql/bin" into /etc/paths.d/mysql. More info in this question.

You can add:
export PATH="/usr/local/mysql/bin:$PATH"
into your .bash_profile file and you need to RESTART the terminal
or open new tab to check the added path.

Related

Is it possible to open new Canoe Config everytime using Dispatch COmmand in Python?

I am using the dispatch command to open Canoe application. But unfortunately I could see that the last saved Canoe config is opened whenever I run this command . But my probem statement is to open New Blank Canoe configuration everytime I run this command .Is it Possible?
Can we also describle the type of Canoe config (CANFD or 1 Ch CAN 500kbps or etc)using the same command?
Thanks in advance
The sample code is as below
import win32com.client
win32com.client.Dispatch('CANoe.Application')
you need to do following:
save blank template as .cfg
I dont sure if you could open directly the template, but this is kind of workaround that can solve your query.
ex: you want 2 different config: Config1 CANFD1 1000kbps, Config2 CAN1 500kbps.
adapt command to load define configuration
in CANoe Help also provide example of Command Line Parameters
CANoe64.EXE /f "D:\CANSystemDemo\CANSystemDemo.CFG"
so if you want to open config for CAN1 500kbps, you have to send command:
CANoe64.EXE /f "C:\yourDirectory\Config2.CFG"

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

Basic MySQL PATH question

In the Terminal prompt, I have to type in $ PATH=/usr/local/mysql/bin:$PATH to run MySQL commands.
Where do I need to save this path in the MySQL files, such that I don't need to type in this path every time I enter into the terminal path. What file, and where should I type this in?
Thank you.
Where can I find the .bashrc file? when I do a cd ~, then ls -a, it does not show up (although I do see a .bash_history.)
You don't have to save $PATH in mysql, you need to save it in your .profile or .bashrc (substitute for your own shell if not Bash) files, found in your home directory.
You have files like these without the dot in frontne in /etc, but they're the system wide ones (they are the default to all users). You should have a file .bashrc or .profile (or you could create them if they don't exist) in your /home/David542 directory (with your own username, of course).
Caveat: depending on your system, you could be using a shell different from bash, so you'd have to create a different dot file (.kshrc, .cshrc, .shrc, etc).
.bashrc in your home directory

Shortcut to MySql on Mac OS X?

I am trying to add a path so I don't have to keep typing usr/local/mysql/bin every time I want to start Mysql. I found instructions here that say:
Edit the file /etc/profile and update the path by adding:
usr/local/mysql/bin/, for example:
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin"
Problems:
1. There is no existing line in my profile file that says 'path'. This is what it currently says in profile:
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval '/usr/libexec/path_helper -s'
fi
if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi
2. I really have no idea what I'm doing on a mac (yet). What do I add/change to the above file so mysql is easier to access?
It depends on whether or not you want all user accounts to have access to MySQL, or just you.
For everyone, edit /etc/profile as instructed and add the following to the end:
export PATH=$PATH:usr/local/mysql/bin
For just you (ALSO, this is safest so you don't accidentally mess up any system variables!):
Get a terminal session: Launch Terminal if it's not already running.
Make sure you're in your home directory:
CD ~
See if .bash_profile exists:
ls -al .b*
If it does, open it with your favorite text editor. If it doesn't, launch your favorite text editor and Save as... .bash_profile in your home folder.
Add this line to .bash_profile and Save:
export PATH=$PATH:/usr/local/mysql/bin
Then close Terminal and open again for the change to take effect.
Hope this works out for you.

How to install MySQL on Leopard, Mac OS X 10.5?

I followed this tutorial to the very end, then found out it didn't work right. I think I have everything installed but when I type
mysql -uroot
I only get
-bash: mysql: command not found
Note: I did not skip the "Setting the Path" step. Upon running this command for the first time:
mate ~/.bash_login
This brought up an empty file. So I added this line:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
I saved the file, closed TextMate, executed the following command:
. ~/.bash_login
...and continued with the tutorial. Based on your suggestions, I thought maybe the file didn't actually get saved. So I ran the following command to bring up the file again:
mate ~/.bash_login
...yet the contents of the file were as they should be.
Any suggestions?
You probably don't have the mysql binaries in your path.
The link you posted has a section on setting the path, titled "Setting the Path Do not skip this step! Most everything else will fail if you do."
EDIT: As debugging steps, try:
First launching a new terminal window. Does it run now?
Typing "echo $PATH" at the prompt. Does the path show up correctly as you've typed it in bash_profile?
Running it the long way: /usr/local/mysql/bin/mysql -u root
Does the application run?
Did you follow the step that says
Setting the Path
Do not skip this step! Most everything
else will fail if you do.
Did you close your terminal window and re-open it afterwards?
Update:
What does "which mysql" say? Does "ls /usr/local/mysql/bin" say?
Two things:
Try editing ~/.profile (rather than ~/.bash_profile or ~/.bash_login).
You may find it easier to use the native Mac style .dmg installer directly from Sun.
One nice thing about the dmg installer is that it automagically sets up symlinks to /usr/local/mysql (which means less - or no - fiddling with your $PATH).
Another option would be to use MAMP.
It has Apache, PHP and MySQL packaged with no further setup necessary.
MySQL is usually put in /usr/local/mysql/bin/
You need to add this to your PATH, you can do this by adding the follwoing lines to your .bash_profile
PATH=$PATH:/usr/local/mysql/bin/
export PATH
The .bash_profile file is located in the root of your username directory.
Make sure you restart your Terminal for the setting to take affect.
And if you're not a command-line person, I highly recommend you also install the MySQL Preference Pane to start/stop the server and install Sequel Pro to create databases and run queries.
ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip
http://www.sequelpro.com/