I am aware that this has been answered multiple times, I get the 1045 error, I am trying to follow https://www.ostraining.com/blog/coding/error-1045-phpmyadmin/, but get this when trying to follow the steps:
Michaels-Air:~ michaelnares$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Michaels-Air:~ michaelnares$ cd /tmp
Michaels-Air:tmp michaelnares$ ls
com.apple.launchd.Uoy1kKt9Ag com.apple.launchd.bRUV1JxWGF mysql.sock.lock
Michaels-Air:tmp michaelnares$
Doing sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock doesn't create the necessary file, what else can I do please?
Is it possible that your mySQL instance is not running?
To check use:
ps aux |grep mysqld
brew reinstall mysql worked, not quite sure why.
Related
I'm trying to have one docker container with: ubuntu 20.04, on top of which I add apache, php, mysql and phpmyadmin (all on the same container)
What's installed:
mysql Ver 8.0.29-0ubuntu0.20.04.2 for Linux on x86_64((Ubuntu))
Apache/2.4.41 (Ubuntu)
phpmyadmin 4:4.9.5+dfsg1-2
PHP 7.4.3
This is the content of my dockerfile:
FROM ubuntu:20.04
MAINTAINER Myself
RUN apt-get update
RUN apt-get -y upgrade
RUN DEBIAN_FRONTEND=noninteractive apt -y install apache2 php libapache2-mod-php mysql-server php-mysql phpmyadmin
# I've set the dbuser to 'admin' dbpass to 'admin' here
COPY ./config-db.php /etc/phpmyadmin/config-db.php
RUN cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
RUN a2enconf phpmyadmin
COPY ./start.sh /start.sh
COPY ./init.sh /init.sh
RUN bash /init.sh
CMD ["bash", "start.sh"]
And this is the content of my init.sh:
#!/bin/bash
service mysql start
# I'm creating the phpmyadmin database here
mysql -u root --password= < /usr/share/phpmyadmin/sql/create_tables.sql
mysql -u root --password= -e "CREATE USER 'admin'#'localhost' IDENTIFIED BY 'admin';"
mysql -u root --password= -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'#'localhost';"
mysql -u root --password= -e "FLUSH PRIVILEGES;"
mysql -u root --password= -e "CREATE DATABASE PROJECT_MANAGEMENT;"
And this is the content of my start.sh:
#!/bin/bash
service mysql start
apachectl -D FOREGROUND
I run my container through docker build -t test . and docker run -d -p 80:80 test (even tried to add -p 3306:3306...). I can access apache2 through localhost:80 and I'm pretty sure mysql is up because my queries worked.
But logging in to localhost/phpmyadmin with username:admin and password:admin just won't work: " Cannot log in to the MySQL server", " mysqli_real_connect(): (HY000/2002): Permission denied", " Connection for controluser as defined in your configuration failed.", " mysqli_real_connect(): (HY000/2002): Permission denied"
(Yes, I have tried to set controluser and controlpass in config.inc.php to admin/admin)
I have no idea what i have to do, I'm overly frustrated, i've tried everything that was on the internet.
Thank you
QUICK-FIX: For some reason phpmyadmin doesn't add the port to the request: I had to set the following in the file /etc/phpmyadmin/config.inc.php: $cfg['Servers'][$i]['host'] = "{$dbserver}:{$cfg['Servers'][$i]['port']}"; after the port directive was set of course.
If someone has a good explanation that'd be greatly appreciated!
I am pretty new to linux and LAMP setup. I want to setup a LAMP environment with AP on one linux server and M on a different linux server. I have a hard time finding a relevant document with such a configuration.
I have done the following steps so far:
server1:
yum install -y httpd
/sbin/service httpd restart
yum install -y php php-mysql
sed -i "s/Listen 80/#Listen 80/g" /etc/httpd/conf/httpd.conf
yum install -y mod_ssl openssl
/sbin/service httpd restart
service iptables stop
I changed the ServerName in /etc/httpd/conf/httpd.conf from
#ServerName www.example.com:80
to
ServerName 172.32.35.14 (ip address of server1)
/sbin/service httpd restart
server2:
yum install -y mysql-libs
yum install -y mysql
yum install -y perl-DBI
yum install -y perl-DBD-MySQL
yum install -y mysql-server
/sbin/chkconfig mysqld on
/sbin/service mysqld start
mysql -u root -e "CREATE USER 'mysqluser' IDENTIFIED by 'password'"
mysql -u root -e "CREATE USER 'mysqluser'#'localhost' IDENTIFIED by 'password'"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'#'localhost' WITH GRANT OPTION"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'mysqluser'#'%' WITH GRANT OPTION"
mysql -u mysqluser -p password -e "CREATE DATABASE mysqldb"
mysql -u mysqluser -p password mysqldb < /tmp/mysqlinstaller/world.sql
service iptables stop
Then I had these post configuration steps:
On server 2, where my mysql is installed, I did the following:
bind-address = 172.32.35.14 (ip of server 1 where apache/php are installed)
service mysql restart
But I am not able to establish a connection. Can you point out what I am missing and guide me please.
OK, a few things that could probably help you:
I don't think that ServerName is doing what you expect it to be. Please check out the docs. TLDR: I don't think you need to modify it for your needs.
The bind-address is actually the address that the MySQL server will bind itself to listen to on so you don't want it to listen on the IP of server1 but on the IP address of server 2. That's most likely the reason why your MySQL can't start. If you're using an older MySQL version make also sure that you have the skip_networking option commented out.
Don't forget to FLUSH PRIVILEGES after creating the user.
And now a couple of questions:
Can you confirm that you have working apache and PHP on server 1?
After completing step 2 of my suggestions can you confirm you have a mysql server up and running on server 2?
Since this will probably require some communication I'll update the answer as we go.
EDIT
So far we've got MySQL up and running on server2 and apache and PHP up and running on server1. There's an issue trying to reach server1 from a host machine but we'll deal with this later on. Now let's make sure that we can connect from PHP to the MySQL on server2.
Can you please create a table inside the mysqldb, insert several rows in it and then try to retrieve those rows from a PHP script on server1?
For now keep accessing the page from server1 via lynx.
First, MYSQL services is running in XAMPP
and, YES, I changed the port since it conflicts with other applications
Now, the question is why can't i connect to MYSQL?
Error 2003: Cant connect to MYSQL server on 'localhost'
I also dont have any mysql services installed.
Please help. Thank you for those people who would answer me :)
First,make sure mysqld is running.
ps -ef |grep mysql
Second,get the socket file in the output of last command:
for example:--socket=/opt/lampp/var/mysql/mysql.sock
Then,try to connect to mysql:
mysql -uroot -p -P<port> -hlocalhost -S /opt/lampp/var/mysql/mysql.sock
option 1.
Goto /bin/
Run mysqld (service)
close the cmd prompt
Run mysql.exe (make sure you add the location path to PATH environment Variable)
Option 2.
try to follow this thread and see if it can help!!
http://forums.devshed.com/mysql-help-4/error-2003-cant-connect-mysql-server-localhost-10061-a-26423.html
Run mysql.exe (make sure you add the location path to PATH environment Variable)
I would to know where is PATH enviroment variable
I am setting up my first data base using XAMPP. I followed the steps from
dev.mysql.com/tech-resources/articles/mysql_intro.html
but as I try to connect to mysqlserver by typing "mysql -u root" into my Terminal I get back an error message:
Phosphoros:~ Arthur$ mysql -u root
-bash: mysql: command not found
Phosphoros:~ Arthur$
I am using Mac OS X 10.7.5.
How can I connect to the server?
Arthur
Your terminal application doesn't know where to locate the mysql program.
For example, if you installed xampp in C:/xampp, you open a command prompt, cd to C:/xampp/mysql/bin and then run your command, which should work now.
Edit: Just remembered you mentioned OSX, regardless, use the same principle. In your terminal, cd to the XAMPP install subfolder which contains the mysql executable app
you have to run the command: mysql -u root in the mysql directory that exists in the /opt/lampp directory.
I'm working on the symfony tutorial jobeet and I have problems to get a database connection to the MySQL-database via doctrine. Development enviroment: Mac OS X and XAMPP.
The command php symfony doctrine:build-schema gives me the following error message:
Warning: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Users/xx/projects/myproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 470
PDO Connection Error: SQLSTATE[HY000] [2002] No such file or directory
The database settings in the database.yml:
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: 'mysql:host=localhost;dbname=my_project_db'
username: root
password: root
MySQl is running. Username and password are correct. The database 'my_project_db' exists.
Could anybody give me a hint what's going wrong?
Try to create a symlink in /var/mysql to your mysql.sock:
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql /var/mysql
Or with MAMP
cd /var; sudo ln -s /Applications/MAMP/tmp/mysql mysql
On Mac OSX Lion:
cd /var;
sudo mkdir mysql; cd mysql;
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
I had the same problem on my apple mac and did the following:
cd /var; sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/ mysql
Worked for me.
This situation also happened to me and I use MAMP Pro. If you use MAMP Pro, its worth checking the main window. Look at "MySQL" tab, and then see "Allow local access only" checkbox. If it is checked, you should uncheck it. Finally, click, "Apply" button.