MySQL started at port 3306
Installing and Configuring Alfresco > Configuring Alfresco > Configuring databases > Configuring a MySQL database > Creating the Alfresco database
mysql -u root -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
/alfresco/mysql/tmp/
1. Je vais à l'emplacement /alfresco avec le terminal et je fais la commande ./alfresco.sh stop
2. Je vais à l'emplacement /etc/rc.d/init.d/ et je fais ./mysqld start
(À ce point-ci, j'ai essayé l'étape suivante sans redémarrer Tomcat puisque le problème concernait MySQL seulement à première vue, mais j'ai essayé ensuite après l'avoir redémarré à partir de /alfresco en faisant ./alfresco.sh start)
3. Je tente de nouveau mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'@'localhost'
, voici quelques façons de le "résoudre", à condition bien sur que mysql soit démarré.ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
ps -ef | grep mysqld
root 1993 1 0 18:37 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/opt/mysql-data –socket=/var/lib/mysql/mysql.sock –pid-file=/var/run/mysqld/mysqld.pid –basedir=/usr –user=mysql
mysql 2130 1993 0 18:37 ? 00:00:22 /usr/libexec/mysqld –basedir=/usr –datadir=/opt/mysql-data –user=mysql –log-error=/var/log/mysqld.log –pid-file=/var/run/mysqld/mysqld.pid –socket=/var/lib/mysql/mysql.sock
romain 6241 3674 0 20:03 pts/2 00:00:00 grep –color=auto mysqld
mysql -u root -p –socket=/alfresco/mysql/tmp/mysql.sock
mysql -u root -p –defaults-file=/alfresco/mysql/my.cnf
ln -s /alfresco/mysql/my.cnf /etc/my.cnf
Dans ce cas vous n'aurez pas à modifier la configuration, ni a passer la socket dans les options de la ligne de commande et vous devriez pouvoir accéder à la base par : mysql -u root -p
mysql -u root -p –socket=/alfresco/mysql/tmp/mysql.sock
mysql -u root -p –defaults-file=/alfresco/mysql/my.cnf
mysql: unknown variable 'defaults-file=/alfresco/mysql/my.cnf'
ln -s /alfresco/mysql/my.cnf /etc/my.cnf
ln: '/etc/my.cnf': fichier inexistant.
mysql -u root -p –defaults-file=/alfresco/mysql/my.cnf
mysql –defaults-file=/alfresco/mysql/my.cnf -u root -p
ln -s /alfresco/mysql/my.cnf /etc/my.cnf
The syntax for creating symbolic links is as follows:Je ne vois pas vraiment comment faire autrement pour ne pas avoir à taper l'option –defaults-file en ligne de commande, car si je choisis un autre nom pour le lien symbolique, alors cela voudrait dire que le lien serait ignoré (et donc inutile) puisque, par défaut, MySQL chercherait toujours le fichier /etc/my.cnf non?
ln -s sourcefile1 [ sourcefile2 … ] target
If target already exists and is not a directory, an error is returned.
socket=/alfresco/mysql/tmp/mysql.sock
socket=/var/lib/mysql/mysql.sock
dir.root=/opt/alfresco/alf_data
web.application.context.url=http://localhost:8080/alfresco
### database connection properties ###
db.driver=org.gjt.mm.mysql.Driver
db.username=alfresco
db.password=alfresco
db.name=alfresco
db.url=jdbc:mysql://localhost:3306/${db.name}?useUnicode=true&characterEncoding=utf8
mysql -u root -p
Voila la réponse ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
J'ai donc voulu vérifier la socket utiliséeps -ef | grep mysqld
voila la réponse ????root 16658 1 0 09:05 ? 00:00:00 /bin/sh /opt/alfresco/mysql/bin/mysqld_safe –defaults-file=/opt/alfresco/mysql/my.cnf –port=3306 –socket=/opt/alfresco/mysql/tmp/mysql.sock –old-passwords –datadir=/opt/alfresco/mysql/data –log-error=/opt/alfresco/mysql/data/mysqld.log –pid-file=/opt/alfresco/mysql/data/ubuntu-virtual-machine.pid –lower-case-table-names=1 –default-table-type=InnoDB
mysql 16772 16658 0 09:05 ? 00:00:15 /opt/alfresco/mysql/bin/mysqld.bin –defaults-file=/opt/alfresco/mysql/my.cnf –basedir=/opt/alfresco/mysql –datadir=/opt/alfresco/mysql/data –user=mysql –old-passwords –lower-case-table-names=1 –default-table-type=InnoDB –log-error=/opt/alfresco/mysql/data/mysqld.log –pid-file=/opt/alfresco/mysql/data/ubuntu-virtual-machine.pid –socket=/opt/alfresco/mysql/tmp/mysql.sock –port=3306
root 17581 17384 0 16:43 pts/0 00:00:00 grep –color=auto mysqld
Donc a priori la socket est bonne.cd /etc/mysql/
ls
mv my.cnf my.cnf.old
ln -s /opt/alfresco/mysql/my.cnf my.cnf
A+
–defaults-file=/opt/alfresco/mysql/my.cnf
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.