What is the equivalent of C:/ in mysql using linux? - mysql

I have this code but I can' figure out how to change the C:/ drive to an equivalent of linux. Below is the code:
SELECT * INTO OUTFILE 'C:/CountryLanguage.txt' FROM CountryLanuage;
I have tried doing '/student', '/home', '/usr', and just plain '/CountryLanguage' I am not sure what to do. Can someone please help me?
Thanks,

Well, this depends on where you would like to save the file.
If you would like to save it in for example "/student" you'll first have to create this folder in the root folder "/". Creating a folder is done by typing:
cd /
mkdir students
Once the directory is created you can make sure it's there by typing:
ls /
Which display all the files and folders in /.
ls /students
Displays all the files in the /students folder.
Since this is in the Linux root you'll have to change the permissions for the folder so that MySQL can write to it. This by typing:
chmod 777 /students
You shall only use 777 for testing since this allows everyone to read, write and execute in that folder but i advise using this to make sure it's not the permissions causing an error.
EDIT:
If you don't have root access to the system you should try saving your file to "/var/lib/mysql/" where MySQL can write.

Related

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

Change permissions on Google Drive folder to work with Apache htdocs

I want to use my Google Drive as a common place to store my websites that get run through apache. I downloaded the Google Drive client and copied my htdocs folder there. I then put a shortcut to this folder where the old htdocs would go. Now when I go to a development site I get greeted with an Access Forbidden! error. Is there a way to change the permissions on this folder or is the whole approach flawed?
The quick way around this is to chmod the folder you're trying to access and any dependencies inside it. I used 755 and recursively applied it to the files inside my project's www folder but you'll likely have to chmod the parent folder even further up using 755.
chmod 755 -R www
If you can't figure out where to apply the permissions changes to, you can read your Apache error logs. I use this command:
tail -f /var/log/apache2/error_log
That should get you sorted out.

mysql folder inaccessible on Ubuntu

I am trying to reset my MySQL root password following the official reference here.
In step #2, I have to do the following
Locate the .pid file that contains the server's process ID. The exact
location and name of this file depend on your distribution, host name,
and configuration. Common locations are /var/lib/mysql/,
/var/run/mysqld/, and /usr/local/mysql/data/. Generally, the file name
has an extension of .pid and begins with either mysqld or your
system's host name.
So I go to /var/lib/ and find the mysql folder. I double-clicked it, I got the following pop-up window:
The folder contents could not be displayed.
You do not have the permissions necessary to view the contents of "mysql".
I am pretty sure that I am indeed the system admin. Why is it like so and how to fix it?
Start with working with the terminal/console as a root user.
Not a system expert - but it should get you somewhere:
Get into the ubuntu terminal/console
switch to the root user (sudo bash)
Then follow this one :
https://help.ubuntu.com/community/MysqlPasswordReset

How do I set MYSQL environment variable in Ubuntu?

So I installed XAMPP (in Ubuntu), and it was successful,
the location of MYSQL is on, /opt/lampp/bin/mysql, and so I have to include the entire path to access mysql as seen below:
$/opt/lampp/bin/mysql -u root -p
And it can login.
But using just "mysql" isn't working; it says not found.
Can you give me an idea on how to set env't variable for mysql?
New in Ubuntu. help? :(
in your home directory there's a file called .bash_profile (use ls -la to see it because files starting with . are by default hidden
There will probably already be a line similar to this one:
PATH=$PATH:$HOME/bin
Change it to
PATH=$PATH:$HOME/bin:/opt/lampp/bin/
This is the easiest way, there are other ways to eg do this so that all users on the system will automatically get this directory in their path, for more detailed answers go to our sister site askubuntu.com

How do I create an alternative root for XAMPP?

I understand that the root of xampp is the htcdocs directory - but I want to create my own directory in my home folder and have that server as my root so that I don't have to go through a million folders to save a file.
I can accomplish this using a symbolic link, but is there a better way to do this????
Thanks so much.
You'll need to edit your httpd.conf file and the restart the server. There should be two things you'll need to replace: the DocumentRoot={current} and a . Just replace the existing path with the path you'd like it to be and restart apache. It should now be serving from the new directory instead of the old one.
You can also use virtual hosts to assign the directory in your home folder to a new domain/ipaddress/port/whatever, but that's quite a bit harder to do.
You can use following link to create Virtual Host -
http://www.mikebernat.com/blog/Adding_Virtual_Hosts_to_Apache_&_Wampserver
Although this is for WAMP. Same information can be used for XAMP