I can not configure MySQL to run from terminal with MAMP - php

I installed MAMP successfully and it works just fine, apache, phpMyAdmin, etc...and followed a tutorial video on youtube on how to configure MySQL so I can use it with terminal. In short, I created a
.profile
file in my home directory with this data in it:
PATH=$PATH:/Applications/MAMP/Library/bin
export PATH
When I shut everything down and restarted the server and terminal and typed mysql in terminal, this is what I get:
-bash: mysql: command not found
Does anybody have any idea what my problem might be? I'm using MAMP 2.0.
Any help would be appreciated.

Related

How to properly install Xampp on Mac in order to run PHP code

I downloaded the installer version of Xampp version 8.1.6-0 for Mac and went to the manager-osx widget to start the Apache and MySQL servers but neither would start.
I then tried using the command sudo apachectl start and then created an index.php file and put it in htdocs, and then tried to open it using http://localhost/index.php as well as http://localhost:8080/index.php and both times it said the server could not be reached.
I've actually downloaded Xamp in the past and was able to reach the server but wasn't able to get php scripts to run, but now for some reason I can't even get the server to run.
I made sure to download the installer and not the virtual machine version. I'm running Monterey version 12.4.
I tried the solutions here but they didn't seem to work. I checked my activity monitor and nothing is running on port 80.
I also installed MAMP from here and tried to start Apache but it displayed the error:
"Apache couldn't be started. Please check your MAMP installation and
configuration."
Any help would be appreciated as I just want to run PHP.

How do I install sqlite on Laravel 5 for WAMP?

I'm using Laravel 5 on my WAMP Server and I am trying to get sqlite to work on it so I can follow the tutorials properly. I've uncommented the following in php.ini and restarted the WAMP server.
extension=php_pdo_sqlite.dll
extension=php_sqlite.dll
extension=php_sqlite3.dll
After restarting the server,
I've created a script to test if sqlite3 is supported or not located in C:\wamp2\www\laravel\test\test.php, and when I run it, the message says 'SQLite 3 supported.' So I know that it is working as far as that is concerned.
<?php
$dbname='base';
if(!class_exists('SQLite3'))
die("SQLite 3 NOT supported.");
$base=new SQLite3($dbname, 0666);
echo "SQLite 3 supported.";
?>
However, when I go into my database.php at: C:\wamp2\www\laravel\test\config\database.php and change the default to,
'default' => 'sqlite',
and then go into the cmd prompt to run the same command they do in the tutorial, which was: "C:\wamp2\www\laravel\test>sqlite3"
I get the error message
'sqlite3' is not recognized as an internal or external command, operable program or batch file.
In git it says:
Joe#JOEALAI /C/wamp2/www/laravel/test
$ sqlite3
sh: sqlite3: command not found
When my default was at 'mysql', it ran perfectly and I was able to connect and create tables no problem.
I am completely stuck. Is there anyone that has had this experience and can help me through this?
The test.php is just testing if the PHP module is installed.
I never worked with WAMP before but I'm pretty sure you need the actual sqlite3 programm installed on your server for the PHP module to work. Try downloading and installing the
Precompiled Binaries for Windows from their website.

how can I run mysql if I installed it from MAMP

So I looked at this question Find out where MySQL is installed on Mac OS X
I have MAMP installed and when I run: /Applications/MAMP/Library/bin/mysql --version It gives me correct output for mysql version.
But if I run type -a mysql it says that it wasn't found, as if I don't have mysql installed.
If I want to run mysql from the terminal I can start my MAMP server, then go to MAMP's library and run ./mysql which will start a mysql session.
HOWEVER: I do NOT want to run it using the current MAMP's server I have. i.e Is there a way to run mysql from any directory, like without using MAMP at all?
I downloaded mysql from mysql site http://www.mysql.com and I can run either the one on my MAMP'S server or the one locally on my machine. I just need to decide which of the two since both are running locally.
you should run the daemon manually but you need to setup the data before that by doing something like data directory initialization mysqld

How to run mysql commands from terminal on a MAMP install?

I just installed mamp (xampp) from the mamp.info page and it is working on my mac (both apache, php, phpmyadmin, and mysql). The only problem is when i try to run
mysql -u root -p
Which connects to mamp from the mac os terminal, i get a command error. I have installed and uninstalled mamp and xampp for mac multiple times to no avail.
I am following this tutorial; http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app and i can't get past a certain part because i don't want to use php admin, and i think it'd be cool to use it from the terminal.
My question; how do i configure mamp or xampp for mac to work from the terminal?
Put this at the end of your .bash_profile script (create it if it doesn't already exist):
export PATH=$PATH:/Applications/MAMP/Library/bin

Why can't CakePHP bake connect to MySQL running under EasyPHP on Windows Vista Ultimate?

I have CakePHP (cake_1.2.2.8120) and EasyPHP (3.0) installed on Windows Vista Ultimate. I followed the "baking" tutorials online and successfully set the database connection with the "cake bake" command from the CLI.
I baked the controller for my "Users" table using the "php cake.php bake controller Users" command - worked fine. However, when I tried baking the view similarly, I got this message:
Fatal error: Call to undefined function mysql_connect() in C:\Web\EasyPHP
\www\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line 374'
Also, the MySQL module is enabled for PHP on the phpMyAdmin page (web), but I can't find it in the CLI (using "php -m" from the command line) even though I've uncommented the "extension=php_mysql.dll" line in the php.ini file.
How can I fix this?
Grab XAMPP which has Apache with the MySQL and PHP modules setup and working together, as well at the MySQL and command-line versions. It just unzips to any directory, so it won't mess up any other Apache installs you have. Just be careful of any port conflicts between the different installations.
Download XAMPP
The root cause of the problem is that in EasyPHP 5.3 there isn't any php.ini file in the php folder.
Copy php.ini from EasyPHP5.3\apache to EasyPHP5.3\php to solve this nasty issue.
Copy the apache/php.ini file to php/php.ini.
I don't know EasyPHP, but it seems to be Apache-based. Check if you're using a Apache-module for the MySQL connection, as this will not work in CLI.

Categories